I am currently trying to solve a perspective problem. Say you had a projected 3D rectangle (not neccesarily square) face defined by the four points $P_0,P_1,P_2,P_3$ as follows:

Figure 1)

My goal is to obtain a function $H(x)$ whose input $x$ is the ratio $\frac{P_0A}{P_0P_1}$ (where $P_0A$ and $P_0P_1$ are the projected distances. Not the original 3D distances), and whose output is the ratio $D(P_0A)/D(P_0P_1)$ where $D$ refers to the original 3D distance.

Intuitively, i want a function that lets me "convert" between 2D and 3D distance percentages on a 3D plane.

My basic idea is as follows: it is simple and possible to subdivide a projected 3D plane in length. Just connect all four corners to find a "middle", and draw a line from one of the vanishing points through this middle to find the intersection edge intersection. This can be done repeatedly, in fact, we could do it infinitely many times. This is how computers would draw a grid: just subdivide some arbitrary amount until it looks decent.

Suppose the edge we are working with has been subdivided $n$ times, into the following smaller distances $d_1,d_2,...d_{2^n}$ as illustrated here with $n=3$:

enter image description here

A good approximation for finding this number between 0 and 1 would be:

$\frac{j | \sum_{i=0}^j < P_0A < \sum_{i=0}^{j+1}}{2^n}$

And, i suppose then, that taking the limit of this as $n \rightarrow \infty$ would yield a perfectly precise result.

Through geometry, i managed to find a function $H(a,b)$ that takes an interval $[a,b]$ of screen distances between $P_0$ and $P_1$, and returns the screen distance between $P_0$ and the perspective midpoint between $a$ and $b$. The specifics of this function are not important at the moment.

I then asked the question: if i subdivide $n$ times, what is the sum of distances to and including $d_i$. For compactness i used the notation $(n,i)$ to indicate this number. Through some relatively simple arguments, i found the following recursive truth:

$(n,i) = (n-1,v), for: i = 2*v$

$(n,i) = H((n-1,v),(n-1,v+1)), for: i = 2*v + 1$

But from this point on i'm unsure as to whether it would be at all fruitful to go any further, especially as i am not super familiar with recursion. We have an "initial value" in that we know the screen length $P_0P_1$, but that's it. We could "keep on digging" forever couldn't we? Would we in this scenario say that $(n,i)$ is defined only in terms of itself, and is therefore impossible to find.

If it is not possible: how would one approach this problem. Does this problem even have a solution? If it is possible: is this approach a good idea, or am i completely down the wrong path?

  • $\begingroup$ Is the real 3D quadrilateral a rectangle? $\endgroup$ Feb 24, 2019 at 21:04
  • $\begingroup$ Yes. I've updated the post with the information. Sorry! $\endgroup$
    – Buster Bie
    Feb 24, 2019 at 21:29
  • $\begingroup$ I would be surprised if this problem required a recursive solution (though I don't know how to find one). Check out cross ratios: en.wikipedia.org/wiki/Cross-ratio $\endgroup$ Feb 24, 2019 at 21:40

1 Answer 1


You can exploit the invariance of cross-ratio in projective transformations.

If you have four points $P_0 A S_1 P_1$ on a line, their cross ratio

$$ r={S_1P_0\cdot P_1A\over S_1A\cdot P_1P_0} $$ is equal to the same quantity computed on the real 3D line. A simple calculation gives then: $$ {D(P_0A)\over D(P_0P_1)}={r-1\over 2r-1}. $$

  • $\begingroup$ Well that was certainly alot simpler! $\endgroup$
    – Buster Bie
    Feb 25, 2019 at 5:53
  • $\begingroup$ Could you please elaborate on how you got that second equation? It appears to be independent of the S1 point on the real 3D line. This would imply that any S1 point on the projected line could be used in the first formula, but using different S1 points give different values for r. $\endgroup$ Jul 5, 2022 at 12:49
  • 1
    $\begingroup$ Point $S_1$ is not a generic point, it is the image of the midpoint of side $P_0P_1$. Hence $D(S_1P_0)/D(P_1P_0)=1/2$. $\endgroup$ Jul 5, 2022 at 14:05
  • 1
    $\begingroup$ Ah that makes more sense then. So you need only the projected Point S1. If Point A is on the second half you swap the components in the first equation. $\endgroup$ Jul 5, 2022 at 15:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .