Euclid’s 2nd proposition draws a line at point A equal in length to a line BC. It uses proposition 1 and is used by proposition 3. I tried to make a generic program I could use for both the primary job of illustrating the theorem and for the purpose of being used by subsequent theorems, but it is simpler to separate those into two sub procedures. The programming was pretty easy except when a line is extended to meet a circle, there are two intersections, and one of them has to be selected. A good illustration with labeled objects helps keep it straight.
In autocad 1-2 is not a problem. The solution would be to copy or move the line endpoint to endpoint. In Euclid, lines cannot be moved. The compass cannot be used to transfer a distance by being picked up off the page. In autocad items are rigid. When two objects the same are copied to the same location they exactly coincide. Euclid’s 4th Axiom is “Things that coincide with one another are equal to one another”. This has caused remarks as to its real meaning. If you cannot move an object to super-impose, how would you know, and even if you could move them, no physical object will perfectly cover another. This common belief, things that are the same coincide, is intended to point to ideal form, like we have in a cad program.
Sub prime_pr2() 'given ptA and lineBC call proposition2 Connect_Acad Dim ptA(0 To 2) As Double Dim ptB(0 To 2) As Double Dim ptC(0 To 2) As Double Dim Ax As Double, Ay As Double Dim Bx As Double, By As Double Dim Cx As Double, Cy As Double Ax = rnddbl(0, 5) Ay = rnddbl(0, 5) Bx = rnddbl(6, 10) By = rnddbl(0, 10) Cx = rnddbl(6, 20) Cy = rnddbl(15, 25) Call pt(ptA, Ax, Ay, 0) Call pt(ptB, Bx, By, 0) Call pt(ptC, Cx, Cy, 0) Call pr2(ptA, ptB, ptC) acadApp.Update End Sub Sub pr2(ptA() As Double, ptB() As Double, ptC() As Double) Dim lineBC As AcadLine Dim lineAB As AcadLine, lineAD As AcadLine, lineBD As AcadLine Dim lineAL As AcadLine, lineBG As AcadLine Dim circH As AcadCircle, circK As AcadCircle Dim r As Double Dim intpts As Variant Dim ptD(0 To 2) As Double Dim ptG(0 To 2) As Double Dim ptL(0 To 2) As Double Set lineBC = acadDoc.ModelSpace.AddLine(ptB, ptC) Set lineAB = acadDoc.ModelSpace.AddLine(ptA, ptB) 'now we need Euclid 1-1 to draw equilateral triangle Call pr2_pr1_sub(ptA, ptB) 'vertex found ptD(0) = ptG1(0) ptD(1) = ptG1(1) ptD(2) = ptG1(2) Set lineAD = acadDoc.ModelSpace.AddLine(ptA, ptD) Set lineBD = acadDoc.ModelSpace.AddLine(ptB, ptD) 'find ptG, do lineBG r = distance(ptB, ptC) Set circH = acadDoc.ModelSpace.AddCircle(ptB, r) intpts = lineBD.IntersectWith(circH, acExtendThisEntity) Call intpts_eval(intpts) 'want ptG intersection farthest from ptD If distance(ptD, ptG1) > distance(ptD, ptG2) Then ptG(0) = ptG1(0) ptG(1) = ptG1(1) ptG(2) = ptG1(2) Else ptG(0) = ptG2(0) ptG(1) = ptG2(1) ptG(2) = ptG2(2) End If Set lineBG = acadDoc.ModelSpace.AddLine(ptB, ptG) 'now find ptL, do lineAL r = distance(ptD, ptG) Set circK = acadDoc.ModelSpace.AddCircle(ptD, r) intpts = lineAD.IntersectWith(circK, acExtendThisEntity) Call intpts_eval(intpts) 'going to take the lesser y value If ptG1(1) > ptG2(1) Then ptG1(0) = ptG2(0) ptG1(1) = ptG2(1) ptG1(2) = ptG2(2) End If ptL(0) = ptG1(0) ptL(1) = ptG1(1) ptL(2) = ptG1(2) Set lineAL = acadDoc.ModelSpace.AddLine(ptA, ptL) 'ptG1 is same as ptL End Sub Sub pr2_pr1_sub(ptA() As Double, ptB() As Double) 'just the bare necessities - no drawing - calculate vertex Dim circD As AcadCircle, circE As AcadCircle Dim r As Double r = distance(ptA, ptB) Set circD = acadDoc.ModelSpace.AddCircle(ptA, r) r = distance(ptB, ptA) Set circE = acadDoc.ModelSpace.AddCircle(ptB, r) Dim intpts As Variant intpts = circD.IntersectWith(circE, acExtendNone) Call intpts_eval(intpts) 'going to take positive y value 'this is how i am passing back found vertex If ptG2(1) > ptG1(1) Then ptG1(0) = ptG2(0) ptG1(1) = ptG2(1) ptG1(2) = ptG2(2) End If circD.Delete circE.Delete End Sub