|
Program "Algebra of Geometric Constructions". Examples. |
Example 1.
Let us take a source file for construction of an equilateral triangle.
|
start() END
|
Points A and B are two vertices of an equilateral triangle. Program computes coordinates of the third vertex, giving an output:
Fractions show exact values of coordinates of point C measured in hundreds of pixels. Meaning of this and meaning of other numbers are explained on the page commands in a description of a command "DrawCoord". |
Example 2.
Next example it is a construction of a square. Fractions of output are simple natural numbers. That is why it is a good example to show how measures are changed, which can be little confusing. One time coordinates are counted in pixels, another time in hundreds of pixels. Literka chose this way to have simpler looking output.
Source file for a construction of a square looks like this:
| start() Title(40,40,$Square) A=point(500,400) B=point(400,600) segment(A,B) L=line(A,B) Ok=circle(A,B) V=IntersCircLin(Ok,L,2) if V==B then StartIf RemovePoint(V) V=IntersCircLin(Ok,L,1) EndOfIf Ok1=circle(V,B) Ok2=circle(B,V) W=Inters2Circ(Ok1,Ok2,1) E=line(A,W) D=IntersCircLin(Ok,E,1) SetName(D,$D) Ok3=circle(D,A) Ok4=circle(B,A) C=Inters2Circ(Ok3,Ok4,2) if C==A then StartIf RemovePoint(C) C=Inters2Circ(Ok3,Ok4,1) EndOfIf SetName(C,$C) Text(20,100,$Look for verticesABCD.) Text(20,120,$We used source text lines with a condition) Text(20,140,$to be sure that C and A are not the same points) Break(1) RemoveTexts segment(D,C) segment(B,C) segment(A,D) RemoveCircle(Ok) RemoveCircle(Ok1) RemoveCircle(Ok2) RemoveCircle(Ok3) RemoveCircle(Ok4) RemoveLine(E) RemoveLine(L) RemovePoint(V) RemovePoint(W) DrawCoord(330,330,A,1) DrawCoord(330,450,A,2) DrawCoord(500,330,B,1) DrawCoord(500,450,B,2) DrawCoord(670,330,C,1) DrawCoord(670,450,C,2) DrawCoord(840,330,D,1) DrawCoord(840,450,D,2) END |
Output looks like this:
Output shows coordinates of 4 vertices of a square. Notice that although first vertex has coordinates (500,400) measured in pixels, output shows coordinates (5,4). It is so because in the second case position is measured in hundred of pixels. It may be confusing, but in fact, it is very simple.
|
Example 3.
Let us consider a source file for a construction of a regular pentagon:
|
//Program “RegPentagon.lit“ of module “Ruler and Compass“
|
This is one of examples of a program "Ruler and Compass". It refers to two procedures in included files: RegPoint and SegmentCenter. First procedure finds a point E on a circle such that AE and AB have equal length, where A and B are points of this circle. Ten last commands draw exact values of coordinates of all verices of a regular pentagon.
|
Example 4.
Let us replace, in the last example, ten DrawDist commands with the following text:
Text(300,280,$Length of a side of a regular pentagon)
Text(300,300,$inscribed into a circle of radius 1)
d1=distance(A1,A2)
DrawDist(420,370,d1)
Text(300,430,$Length of a diagonal of a regular pentagon)
Text(300,450,$inscribed into a circle of radius 1)
d2=distance(A1,A3)
DrawDist(420,510,d2)
We receive exact values of length of a side and of a diagonal of regular pentagon inscribed into circle of radius 1.

Example 5.
The following example shows the exact values of a
center of inscribed circle into a triangle. This is an example of a program Ruler
and Compass. Part of this program, corresponding to construction of a
circumscribed circle, is deleted. The center of circumscribed circle cannot be
computed by a computer with the current version of a program. Probably
computations require better simplification procedures. Literka will work on this
problem.
However, it takes about 5 sec. to compute the center of inscribed circle:
| 1// “Literka“, program-example “step5.lit“ // Program of “Module Ruler and Compass“ // For a given triangle program builds inscribed circle // and shows exact values of coordinats of center of this circle #include <BisectLine.ltu> // Next procedure constructs and returns a line // which is a symmetric line of segment AB i.e. // passes through the center of AB and is perpendicular // to AB. line SymmetricalLine(point A,point B) C2=circle(A,B) C3=circle(B,A) H=Inters2Circ(C2,C3,1) K=Inters2Circ(C2,C3,2) P=line(H,K) RemovePoint(H) RemovePoint(K) RemoveCircle(C2) RemoveCircle(C3) return(P) END void start() //Title(100,70,$Triangle. Inscribed and Circumscribed //Circles.) A=point(200,500) B=point(400,200) C=point(600,600) SetName(C,$C) segment(A,B) segment(B,C) segment(A,C) S=BisectLine(A,B,C) Z=BisectLine(B,A,C) H=Inters2Lin(S,Z) DrawCoord(670,300,H,1) DrawCoord(670,390,H,2) SetName(H,$O) //Text(600,500,$We found intersection of two //bisectlines.) Text(600,520,$We denote this point by O.) Text(600,540,$This is the center of inscribed circle.) END |
|
Program "Algebra of Geometric Constructions" provides few additional commands, which simplify source files. They are not like commands of a program "Ruler and Compass" and they do not correspond to ruler and compass constructions. Main idea is to construct series of triangles to receive desired lengths, radiuses etc. We can use them to receive exact trigonometric values of given angles. See few examples of using additional commands.