Box100-Front-1to1-Perspective.mws

>    with(linalg):

The matrix extracted out of the picture:

>    M:=array(1..4,1..4,[ [2.414213 , 0.0     , 0.0     , -120.710678],
                     [0.0      , 0.0     , 2.414213, -120.710678],
                     [0.0      , 4.315908, 0.0     , -165.794556],
                     [0.0      , 1.0     , 0.0     ,  166.680573]]);

M := matrix([[2.414213, 0., 0., -120.710678], [0., 0., 2.414213, -120.710678], [0., 4.315908, 0., -165.794556], [0., 1.0, 0., 166.680573]])

Here the With  and Height  of the Picture:

>    w,h := (1024,1024);

w, h := 1024, 1024

The point coordinates of the location you search in the picture:

>    px,py,pz := (0.0, 0.0, 0.0);

px, py, pz := 0., 0., 0.

The matrix multiplication:

>    Q := multiply(M,array(1..4,[px, py, pz, 1]));

Q := vector([-120.710678, -120.710678, -165.794556, 166.680573])

>    k := min(w,h);

k := 1024

>    S:= multiply( array(1..3,1..3,[[k,0 ,w  ],
                               [0,-k,h  ],
                               [0, 0,1.0]]), array(1..3,[Q[1]/Q[4], Q[2]/Q[4], 1]) );

S := vector([282.4154707, 1765.584529, 1.0])

>    x := S[1] * 0.5;

>    y := S[2] * 0.5;

x := 141.2077354

y := 882.7922645

>    px,py,pz := (0.0, 0.0, 100.0);

px, py, pz := 0., 0., 100.0

The matrix multiplication:

>    Q := multiply(M,array(1..4,[px, py, pz, 1]));

Q := vector([-120.710678, 120.7106220, -165.794556, 166.680573])

>    k := min(w,h);

k := 1024

>    S:= multiply( array(1..3,1..3,[[k,0 ,w  ],
                               [0,-k,h  ],
                               [0, 0,1.0]]), array(1..3,[Q[1]/Q[4], Q[2]/Q[4], 1]) );

S := vector([282.4154707, 282.4158148, 1.0])

>    x := S[1] * 0.5;

x := 141.2077354

>    y := S[2] * 0.5;

y := 141.2079074

>