MathDraw

A Textbook of Euclidean Geometry

&

A Tool of Computer Aided Symbolic Design

by

Denis Monasse

Introduction

MathDraw in its present version can build all the geometrical objects which traditionally require ruler and compsssea.

<<MathDraw.m

Objects

Point
StraightLine
Circle
Draw

A=Point[1,1]
Æ=StraightLine[1,2,1]
K=CircleAlone[0,0,1]
Draw[{{A,"A"},
      RGBColor[1,0,0],Æ,
      RGBColor[0,1,0],K},
     {-2,2},{-2,2}]

Basic Constructions

Random Objects

Draw[Table[{RandomPoint[Real,{-1,1}],
            StringJoin["M",ToString[i]]},
           {i,20}],
     {-1,1},{-1,1}]

Draw[Table[RandomStraightLine[Real,{-1,1}],{i,20}],
        {-1,1},{-1,1}]

Symbolic Objects

point=Point[p]

sl=StraightLine[d]

Constructions

StraightLine passing through two points

B=Point[-Sqrt[2]//N,-1]
AB=A.B
Draw[{RGBColor[0,0,1],{A,"A"},{B,"B"},
      RGBColor[1,0,0],AB},
     {-2,2},{-2,2}]

Center of a circle

CircleCenter[K]

Variable point on an object

p=PointParameter[K,Pi/4]
Draw[{RGBColor[0,1,0],K,
      RGBColor[0,0,1],{p,"P"}},
     {-1,1},{-1,1}]

Circle of given center passing through a given point

ce=CircleByCenterAndPoint[A,B]
Draw[{RGBColor[0,0,1],{A,"A"},{B,"B"},
      RGBColor[0,1,0],ce},
     {-3,5},{-3,5}]

Intersections

p=Æ*K
Draw[{RGBColor[1,0,0],Æ,
      RGBColor[0,1,0],K,
      RGBColor[0,0,1],{p[[1]],"P1"},{p[[2]],"P2"}},
     {-2,2},{-2,2}]

Straight line parallel to a straight line and passing through a point

sl=StraightLineParallel[Æ,A]
Draw[{RGBColor[1,0,0],Æ,sl,
      RGBColor[0,0,1],{A,"A"}},
     {-2,2},{-2,2}]
sl

Straight line perpendicular to a straight line  and passing through a point

slp=StraightLinePerpendicular[Æ,A]
Draw[{RGBColor[1,0,0],Æ,slp,
      RGBColor[0,0,1],{A,"A"}},
     {-2,2},{-2,2}]
slp

Symmetric of an object with respect to another object

sls=Symmetric[sl,Æ]
Draw[{RGBColor[1,0,0],sls//N,sl,Æ},
     {-4,4},{-4,4}]
sls

Middle of two points

M=Middle[A,B]
Draw[{RGBColor[0,0,1],{A,"A"},{B,"B"},{M,"M"}},
     {-2,2},{-2,2}]
M

Mediatrix of two points

mx=Mediatrix[A,B]
Draw[{RGBColor[1,0,0],mx,
      RGBColor[0,0,1],{A,"A"},{B,"B"}},
     {-2,2},{-2,2}]
mx

Bisectors of two straight lines

b=Bisectors[Æ,slp]
Draw[{RGBColor[1,1,0],b[[1]]//N,b[[2]]//N,
      RGBColor[1,0,0],Æ,slp},
     {-2,2},{-2,2}]
b

Projection of a point

p=A>Æ
Draw[{RGBColor[0,0,1],{p//N,"P"},{A,"A"},
      RGBColor[1,0,0],Æ},
     {-2,2},{-2,2}]
p

Tests

ParallelQ[sl,slp]

PerpendicularQ[sl,slp]

OfQ[p,Æ]

AlignedQ[M,A,B]

?TangentQ

?ConcentricQ

More Constructions

Circle given by a diameter

ce=CircleByDiameter[A,B]
Draw[{RGBColor[0,1,0],ce,
      RGBColor[0,0,1],{A,"A"},{B,"B"}},
      {-2,2},{-2,2}]
ce

Circle given by three points

P=Point[-1.5,Sqrt[2]//N]
ce=CircleByThreePoints[A,B,P]
Draw[{RGBColor[0,1,0],ce,
      RGBColor[0,0,1],{A,"A"},{B,"B"},{P,"P"}},
      {-2,2},{-2,2}]
ce

Center of gravity of a triangle

triangle=Line[Apply[List,{A,B,P,A},2]]
AB=A.B;BP=B.P; PA=P.A
A1=Middle[B,P];B1=Middle[A,P];P1=Middle[B,A]
m1=Line[Apply[List,{A,A1},2]]
m2=Line[Apply[List,{B,B1},2]]
m3=Line[Apply[List,{P,P1},2]]
G=CenterOfGravity[A,B,P]
Draw[{RGBColor[1,0,0],triangle,
      RGBColor[1,1,0],m1,m2,m3,
      RGBColor[0,0,1],{A,"A"},{B,"B"},{P,"P"},{G,"G"},
                      {A1,"A1"},{B1,"B1"},{P1,"P1"}},
     {-2,2},{-2,2}]
ConcurrentQ[P.P1,A.A1,B.B1]

Orthocenter of a triangle

AB=A.B;BP=B.P; PA=P.A
A1=Intersection[StraightLinePerpendicular[A,BP],BP]
B1=Intersection[StraightLinePerpendicular[B,PA],PA]
P1=Intersection[StraightLinePerpendicular[P,AB],AB]
H=Orthocenter[A,B,P]
m1=Line[Apply[List,{A,A1},2]]
m2=Line[Apply[List,{B,B1},2]]
m3=Line[Apply[List,{P,P1},2]]
Draw[{RGBColor[1,0,0],triangle,
      RGBColor[1,1,0],m1,m2,m3,
      RGBColor[0,0,1],{A,"A"},{B,"B"},{P,"P"},{H,"H"},
                      {A1,"A1"},{B1,"B1"},{P1,"P1"}},
     {-2,2},{-2,2}]
ConcurrentQ[P.P1,A.A1,B.B1]

Center of a circle circumscribed to a triangle

M1=Mediatrix[B,P];M2=Mediatrix[A,P];M3=Mediatrix[B,A]
M=CenterOfCircumscribedCircle[A,B,P]
ce=CircleByThreePoints[A,B,P]
Draw[{RGBColor[1,0,0],triangle,
      RGBColor[1,1,0],M1,M2,M3,
      RGBColor[0,0,1],{A,"A"},{B,"B"},{P,"P"},{M,"M"},
      RGBColor[0,1,0],ce},
     {-2,2},{-2,2}]

Center du circle inscrit dans un triangle

B1=Intersection[Bisectors[AB,BP][[2]],PA]
P1=Intersection[Bisectors[BP,PA][[2]],AB]
A1=Intersection[Bisectors[PA,AB][[2]],BP]
m1=Line[Apply[List,{A,A1},2]]
m2=Line[Apply[List,{B,B1},2]]
m3=Line[Apply[List,{P,P1},2]]
OI=CenterOfInscribedCircle[A,B,P]
ce=CircleByCenterAndPoint[OI,OI>AB]
Draw[{RGBColor[1,0,0],triangle,
      RGBColor[1,1,0],m1,m2,m3,
      RGBColor[0,0,1],{A,"A"},{B,"B"},{P,"P"},
                      {A1,"A1"},{B1,"B1"},{P1,"P1"},
                      {OI,"I"},
      RGBColor[0,1,0],ce},
     {-2,2},{-2,2}]
OI

Euler Straight line of a triangle

It is the straight line joining the orthocenter, the center of the circumscribed circle and the center of gravity of a triangle.

AlignedQ[G,H,M]

Draw[{RGBColor[1,0,0],triangle,StraightLineEuler[A,B,P],
      RGBColor[0,0,1],{A,"A"},{B,"B"},{P,"P"},
                      {G,"G"},{H,"H"},{M,"M"}},
     {-2,2},{-2,2}]

Envelopes

Example: Envelope of a radius of light coming from infinity in the direction (0,1) and reflected
on a circular mirror (caustic of a circle).

U[t_]=PointParameter[K,t]
Delta[t_]=StraightLineParallel[StraightLine[0,1,0],U[t]]
radius[t_]=Point[0,0].U[t]
sym[t_]=Symmetric[Delta[t],radius[t]]
f[t_]=(Apply[List,StraightLinesEnvelope[sym[t],t]]/.
      Cos[t]^2->1-Sin[t]^2)//Factor

gr1=ParametricPlot[f[t],{t,-Pi,Pi},
                   AspectRatio->Automatic]

gr2=Draw[{RGBColor[0,1,0],K,
          RGBColor[1,0,0],Delta[t],sym[t],
          RGBColor[1,1,0],radius[t]}/.t->0.7,
         {-2,2},{-2,2}];
Show[Graphics[{RGBColor[1,0,0]}],gr1,
     gr2]

Index

AlignedQ
AlignedQ[M1,M2,M3] is True if the three points M1, M2, M3 are aligned.

BarycentricCoordinates
BarycentricCoordinates[M,{A1,A2,A3}] returns the list of barycentric coordinates  of M in the affine system (A1,A2,A3).

Bisectors
Bisectors[D1,D2] returns the two bisectors of (D1, D2).

CenterOfCircumscribedCircle
CenterOfCircumscribedCircle[A,B,C] returns the center of the circle circumscribed to the triangle ABC.

CenterOfGravity
CenterOfGravity[A,B,C] returns the center of gravity of A, B, C.

CenterOfInscribedCircle
CenterOfInscribedCircle[A,B,C] returns the center of the circle inscribed in the triangle ABC.

Circle
Circle[x,y,r] is the circle of center (x,y) and of radius r.

CircleByCenterAndPoint
CircleByCenterAndPoint[C,M] returns le circle of center C passing through M.

CircleByDiameter
CircleByDiameter[A,B] returns the circle of diameter AB.

CircleByThreePoints
CircleByThreePoints[A,B,C] returns the circle passing through A,B et C.

CircleCenter
CircleCenter[C] returns the center of the circle C.

ConcentricQ
ConcentricQ[C1,C2] is True if the two circles C1 and C2 are concentric.

ConcurrentQ
ConcurrentQ[D1,D2,D3] is True if the three straight lines are concurrent or parallel.

Draw
Draw[{list},{xMin,xMax},{yMin,yMax}] draws, in the rectangle  xMin, xMax, yMin, yMax, the objects of list. The list of objects may be made of points, straight lines, circles, of named points 
(of the form {Point[x,y],name}or of any Mathematica graphical object such as RGBColor.

EqualQ
EqualQ[Object1,Object2] is True if two objects are identical. 
Abbreviation: Object1==Object2.

Intersection
Intersection[Object1,Object2] returns the intersection(s) of two objects (straight lines or circles). Abbreviation: Object1*Object2.

Mediatrix
Mediatrix[M1,M2] returns the straight line mŽdiatrix of the segment M1 M2.

Middle
Middle[M1,M2] returns thee Middle of M1 and M2.

OfQ
OfQ[M,Object] or OfQ[Object,M] is True if the point M belongs to Object (Circle or StraightLine).

Orthocenter
Orthocenter[A,B,C] returns the orthocenter of the triangle ABC.

ParallelQ
ParallelQ[D1,D2] is True if the two straight lines D1 and D2 are Parallel. 

PerpendicularQ
PerpendicularQ[D1,D2] is True if the two straight lines D1 and D2 are perpendicular.

Point
Point[x,y] is the point of coordinates (x,y). 
Point[u] returns the point Point[u[1],u[2]].

PointParameter
PointParameter[Object,t] returns the point of parameter t of the object which may be a straight line or a circle.

PointQ
PointQ[M] is True if M is a point.

Projection
Projection[M,Object] returns the point projection of M onto Object (StraightLine or Circle). Abbreviation:  M>Object.
  
RandomPoint 
RandomPoint[...] retourns a random point (see Random parameters).

RandomStraightLine 
RandomStraightLine[...] returns a random straight line au hasard (see Random parameters).

StraightLine
StraightLine[u,v,w] is the straight line of equation ux+vy+w=0. 
StraightLine[Ox] and StraightLine[Oy] return the two axes. 
StraightLine[u] returns the straight line StraightLine[u[1],u[2],u[3]].

StraightLineQ
StraightLineQ[D] is True if D is a straight line.

StraightLineByTwoPoints
StraightLineByTwoPoints[M1,M2] returns the straight line passing through M1 et M2. Abbreviation  M1.M2.

StraightLinesEnvelope
StraightLinesEnvelope[D,t] returns the envelope of straight lines D whose coordinates are function s of the parameter t.
  
StraightLineEuler
StraightLineEuler[A,B,C] returns the Euler straight line of the triangle ABC.

StraightLineParallel
StraightLineParallel[D,M] returns the straight line parallel to D passing through M.

StraightLinePerpendicular
StraightLinePerpendicular[D,M] returns the straight line perpendicular to D passing through M.

Symmetric
Symmetric[Object1,Object2] returns the symmetric of Object1 (StraightLine, Circle or Point) with respect to Object2 (StraightLine or Point). Abbreviation: Object1/Object2.

TangentQ
TangentQ[D,C] is True if the straight line D is tangent to the circle C.