In short: How to calculate h0...h4?
When imitating perspective, which formula is used to calculate h(0) to h(n) distances when known deformation values like either top-width-to-bottom-width ratio, or angle a (whichever parameter is useful for that)?
In short: How to calculate h0...h4?
When imitating perspective, which formula is used to calculate h(0) to h(n) distances when known deformation values like either top-width-to-bottom-width ratio, or angle a (whichever parameter is useful for that)?
We can see perpective transformation having axial symmetry around vertical axis.
So transformation of rectangle with coordinates (0,0)-(SrcWdt, SrcHgt) with axial line at SrcWdt/2

gives trapezoid centered vertically with axial line at DstWdt/2 and coordinates of right corners RBX, RBY, RTX, RTY
In this case transformation formulas are a bit simpler (than general case)
X' = DstXCenter + A * (X - XCenter) / (H * Y + 1)
Y' = (RBY + E * Y) / (H * Y + 1)
And we can calculate coefficients A, E, H without solving of eight linear equation system using only coordinates of two corners of trapezoid.
Delphi code:
procedure CalcAxialSymPersp(SrcWdt, SrcHgt, DstWdt, RBX, RBY, RTX, RTY: Integer;
var A, H, E: Double);
begin
A := (2 * RBX - DstWdt) / SrcWdt;
H := (A * SrcWdt/ (2 * RTX - DstWdt) - 1) / SrcHgt;
E := (RTY * (H * SrcHgt + 1) - RBY) / SrcHgt;
end;
Having coefficients, we can apply transformation to any source point PSrc and get coordinates of mapped point. In your case PSrc.X = 0 and PSrc.Y = i * SrcHgt / 5 for i=1..4 will give Y-coordinates od horizontal lines.
procedure PerspMap(SrcWdt, DstWdt, RBY: Integer; A, H, E: Double; PSrc: TPoint): TPoint;
begin
Result.X := Round(DstWdt / 2 + A * (PSrc.X - SrcWdt/2) / (H * PSrc.Y + 1));
Result.Y := Round((RBY + E * PSrc.Y) / (H * PSrc.Y + 1));
end;