Proportion tutorial: making a golden rectangle from two points.
Any two points, A and B, define a line, and a square can be constructed whose top edge is on that line. Let C be the midpoint between A and B, and D be the corner of the square farthest from A. The circle with center at C, through D, intersects the line AB in two places; let E be the intersection furthest from A. Let F be the corner of the square furthest from B; the rectangle with corners F, A, and E is a golden rectangle.

Please look at the source code of this page for more information.