% This figure is showing Abdul al Wafa's method to draw
% an equilateral triangle incribed in a square.
% Copyright (c) Christian Obrecht 2001

box(-1,-1,7,7)

A B C D square
O = barycenter(A,B,C,D)
P = rotation(O,C)
c1 = circle(A,C)
c2 = circle(O,P)
I1 I2 intersection(c1,c2)
E = intersection(line(A,I1),line(D,C))
F = intersection(line(A,I2),line(B,C))

draw(A,B,C,D)
color(lightgray)
draw(segment(A,C)) ; draw(segment(B,D))
color(blue)
draw(c1) ; draw(c2)
color(red)
draw(A,E,F)
