First of all the transformation from 3-view to foreshortened picture
needs to be captured mathematically.
![]() |
![]() |
![]() |
In the 3-view we have a point P, given by its coordinates (x, y). | The x coordinate is shortened (hence the name foreshortening?). Mathematically we formulate this by multiplying with a number z, which is less than 1.0. The new point P' is (z*x, y). | And lastly the point is moved upward. Technically an auxiliary x-axis is drawn and the original y coordinate taken from there. Mathematically we calculate the offset from the x coordinate of P' and the angle α. So P" is (z*x, y + z*x*tan(α)). |
Now let P be an element of a circle centered at (0,0) and with radius r:
(1) P(φ) = r*(cos(φ), sin(φ))φ is a so called free parameter; think of it as denoting uniquely each point of the circle.
(2) P"(φ) = r*(z*cos(φ), sin(φ) + z*tan(α)*cos(φ))The distance K(φ) from (0,0) to P'' is easy to calculate using old friend Pythagoras (left as exercise for the reader ;-).
It is not unrealistic to expect some variation in K as we move φthrough a full period 0..360°. Especially there will be two maxima and two minima. To find them, we simply differentiate K with respect to φand look for the roots:
(3) dK/dφ = C(φ) * ((1 - z2 * (tan2(α) + 1))*sin(2φ) + 2*z*tan(α)*cos(2φ)) = 0If we ignore the term C(φ) (= 0.5 / K(φ), which will never become zero anyway), this collapses conveniently to
(4) tan(2φ) = 2*z*tan(α) / (z2 * (tan2(α) + 1) - 1)which has the required number of solutions, namely:
(5) Φ = { φ, φ+90°, φ+180°, φ+270° }Now all we have to do is to calculate K(φ) and K(φ+90°) to get the two half-axis of the ellipse. Depending on size, we sort them into A and B. For the φ we used to get A, P'' is calculated and the angles w determined, conveniently using the atan2 function (if available):
(6) A = 2*K(φ1)Remains to define the geometric link to the user interface:
(7) B = 2*K(φ2)
(8) wr = atan2(y"(φ1), x"(φ1))
(9) wl = 90° - atan2(y"(φ1), x"(φ1))
(10) r = Y / 2
(11) z = H / Y
(12) cos(α) = H / X => tan2(α) = X2 / H2 - 1