Central & Parallel Projection Matrix construction
Centralprojection construction projection matrix
CAM=(Cx,Cy,Cz)T
We start with a projection line CAM to a point (x1,x2,x3)T of interrest
intersept with a plane
===> ===>
t ∈ p found a point projected on E
writing as coordinate vector in matrix Mcam (denominator extracted and added in homogeneous CO)
transfering to matrix PzH in homogeneous coordinates
Example CAM=(4,2,3) , E := 2x + y + z = 1
CAM=(Cx,Cy,Cz) and plane n1 x + n2 y + z n3 = d
user-function-central-projection homogeneous coordinates
Pz_H(Cx,Cy,Cz,n1,n2,n3,d):=Take({{((-Cy)*n2)-(Cz*n3)+d,(Cx*n2),(Cx*n3),((-Cx)*d)},{(Cy*n1),((-Cx)*n1)-(Cz*n3)+d,(Cy*n3),((-Cy)*d)},{(Cz*n1),(Cz*n2),((-Cx)*n1)-(Cy*n2)+d,((-Cz)*d)},{n1,n2,n3,((-Cx)*n1)-(Cy*n2)-(Cz*n3)}},1,4);
Transfers
HxT(AA):=Take(AA/Element(AA,4),1,3)
TxH(AA):=Transpose(Flatten({Vector(AA)})+{0,0,0,1})
PointHP3d(aa):=(Element(Flatten(aa), 1),Element(Flatten(aa), 2),Element(Flatten(aa), 3))/Element(Flatten(aa), 4)
PointHv3d(aa):=Substitute(Vector((x,y,z)), {x,y,z}= Take(Flatten(aa),1,3)/Take(Flatten(aa),4,4))
Test
K_CAM, Cube, E projektion plane
{A=vector((2,1,1)) , TxH(A) , Z_H TxH(A) , HxT(Z_H TxH(A))}
Test
CAM_FigKamera, Fig Pointlist, FigZxy point image in plane z=0, FigZxy point image in plane y=0
In classic mathematical theorem the y axis is vertical alined. here we use the school based coordinate system by z axis vertical (the projection was made for plane y=0, but plotted to plane z=0)
Z_y (projection matrix)
CentralProjectionConstructionCAS.ggb (matrix user-function)
Parallel projektion
Konstruktion einer Matrix zur Parallel-Projektion
vector in direction of projection
CAM=(cx,cy,cz)T
We start with a projection line of a point (x1,x2,x3)T of interrest in direction CAM
intersept with a plane
===> ===>
t ∈ p found a point projected on E
building images of base vectors X=e1,e2,e3
writing Bcam as matrix PpH in homogeneous coordinates
CAM=(cx,cy,cz) and plane n1 x + n2 y + z n3 = d
user-function parallel projection homogeneous coordinates
PP_H(c_x,c_y,c_z,n_1,n_2,n_3,d):= 1/((c_x * n_1) + (c_y * n_2) + (c_z * n_3))* {{c_z n_3 + c_y n_2, -n_2 c_x, -n_3 c_x, c_x d}, {-n_1 c_y, c_z n_3 + c_x n_1, -n_3 c_y, c_y d}, {-n_1 c_z, -n_2 c_z, c_y n_2 + c_x n_1, c_z d}, {0, 0, 0, ((c_x * n_1) + (c_y * n_2) + (c_z * n_3))}}
Example: Pp_H( 2, 4, 3, 0, 1, 1, 1)
Transfers from/to homogeneous coordinates (vector/column matrix)
HxT(AA):=Take(AA/Element(AA,4),1,3)
TxH(AA):=Transpose(Flatten({Vector(AA)})+{0,0,0,1})