(* This figure illustrates DeSargues's Theorem from projective geometry. Start with any three concurrent lines (the dark blue lines "a0", "bO", and "cO" in the figure). Pick a pair of points on each line, and connect the points to form two triangles. When the corresponding sides of these triangles are extended, they meet at three intersection points. These three points are colinear (shown by the red line in the figure). *) PRIVATE CONST ExtendFactor = 50; PROC DrawLongLine(a, b) IS PS.MoveTo((-ExtendFactor, 0) REL (a, b)); PS.LineTo((ExtendFactor, 0) REL (a, b)) END; UI PointTool(DrawLongLine); PRED ThreeColinear(a, b, c, d, e, f, g) IS Geometry.Colinear(d, a, g) AND Geometry.Colinear(e, b, g) AND Geometry.Colinear(f, c, g) END; UI PointTool(ThreeColinear); PRED Intersect(c, a, b, d, e) IS Geometry.Colinear(a, b, c) AND Geometry.Colinear(c, d, e) END; UI PointTool(Intersect); (* "c" is the intersection of the line "ab" and the line "de". *) PROC Cmd0() IS IF VAR a = (-67.40699, -146.38841), b = (0, -157.00726), c = (84.826775, -99.36208), O = (-5.3016734, 161.5582), A1 ~ (-22.900566, 74.29483), C1 ~ (-3.0934858, 28.873247), B1 ~ (36.656887, 40.088905), A2 ~ (-63.066387, -124.865715), C2 ~ (-2.1308067, -28.97196), B2 ~ (69.011345, -53.576694), AC ~ (12.257393, -6.329385), BC ~ (-94.67274, 3.0339568), AB ~ (136.4059, -17.200441) IN ThreeColinear(A1, C1, B1, a, b, c, O) AND ThreeColinear(A2, C2, B2, a, b, c, O) AND Intersect(AC, A2, C2, A1, C1) AND Intersect(BC, C1, B1, C2, B2) AND Intersect(AB, A2, B2, A1, B1) -> DrawLongLine(a, O); DrawLongLine(b, O); DrawLongLine(c, O); PS.SetWidth(2); PS.SetColor(Color.Blue); PS.Stroke(); DrawLongLine(AC, C2); DrawLongLine(AC, C1); DrawLongLine(C1, BC); DrawLongLine(C2, BC); DrawLongLine(AB, B1); DrawLongLine(AB, B2); PS.SetWidth(1); PS.SetColor(Color.Cyan); PS.Stroke(); DrawLongLine(AB, BC); PS.SetWidth(2); PS.SetColor(Color.Red); PS.Stroke(); Triangle.Draw(A2, B2, C2); Triangle.Draw(A1, C1, B1); PS.SetColor(Color.Black); PS.SetJointStyle(PS.BevelJoints); PS.Stroke() END FI END;