Program "Algebra of Geometric Constructions".

Examples.

 

 

 

Example 1.

Let us take a source file for construction of an equilateral triangle.

start()
S=String($Construction of Equilateral Triangle.)
Title(100,20,S)
A=point(400,500)
B=point(600,400)
segment(A,B)
C1=circle(A,B)
C2=circle(B,A)
D=Inters2Circ(C1,C2,1)
SetName(D,$C)
RemoveCircle(C1)
RemoveCircle(C2)
segment(B,D)
segment(A,D)
DrawCoord(250,300,D,1)
DrawCoord(250,450,D,2)

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“
//You can run this program pressing F7 or F8 and then spaces.
//Program constructs regular pentagon

#include <..\library\PerpPoint.ltu>
#include <..\library\CenterSegment.ltu>
#include <..\library\PointOfCircle.ltu>

start()
//Run next line to see polygon only
//NoNames

Title(100,50,$RegularPentagon)


A=point(200,400)
B=point(300,400)

C=circle(A,B)
L=line(A,B)
LL=Perp(L,A)
name(LL)=no
// we cannot have name of LL written, since it overlaps with another name.

E=IntersCircLin(C,LL,1)
SetName(E,$E)
F=SegmentCenter(E,A)
C1=circle(F,B)

SetName(F,$F)

G=IntersCircLin(C1,LL,1)

if Between(G,A,F) then StartIf
RemovePoint(G)
G=IntersCircLin(C1,LL,2)
EndOfIf

SetName(G,$G)

C2=circle(B,G)
name(C2)=no

Text(500,100,$Draw straight lineAB)
Text(500,120,$Draw circle with center A and radius AB)
Text(500,140,$Draw line perpendicular to AB passing through A)
Text(500,160,$Take point E intersection of line and circle)
Text(500,180,$Take point F center of AE)
Text(500,200,$Draw circle with center F and radius FB.)
Text(500,220,$Take a point G intersection of two circles.)

Break(1)
RemoveTexts

A1=Inters2Circ(C,C2,1)
SetName(A1,$H)

Text(500,180,$Draw a circle with center B and radius BG.)
Text(500,200,$Take point H intersection of two circles.)
//Text(500,220,$Points B and G are two vertices of regular //pentagon) 

Break(1)
RemoveTexts


A2=RegPoint(C,B,A1)
A3=RegPoint(C,A1,A2)
A4=RegPoint(C,A2,A3)

//Text(500,180,$We use procedure RegPoint to find three other //vertices)
//Text(500,200,$This procedure is described in the file //PointOfCircle.ltu)

W=polygon(B,A1,A2,A3,A4)
fill(W)=yellow

Break(1)
RemoveTexts

//Run the following lines, if you
//do not want to see construction process.
//Notice that you may run step-by-step
//pressing F7 and spaces later.

RemoveCircle(C)
RemoveCircle(C1)
RemoveCircle(C2)
RemoveLine(L)
RemoveLine(LL)
RemovePoint(A)
RemovePoint(E)
RemovePoint(F)
RemovePoint(G)

DrawCoord(450,200,A1,1)
DrawCoord(450,310,A1,2)

DrawCoord(450,500,A2,1)
DrawCoord(450,610,A2,2)

DrawCoord(850,200,A3,1)
DrawCoord(850,310,A3,2)

DrawCoord(850,500,A4,1)
DrawCoord(850,610,A4,2)

DrawCoord(100,500,B,1)
DrawCoord(100,600,B,2)

END

 

 

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.