CAM=(Cx,Cy,Cz)[sup]T[/sup] [br][br]We start with a projection line CAM to a point (x1,x2,x3)[sup]T[/sup] of interrest[br][br] [math]p \, := \, CAM + t \; \left(X - CAM \right)[/math][br][br]intersept with a plane[br][br] [math]E:\;\left(\begin{matrix}n_1\\n_2\\n_3\end{matrix}\right)\cdot \vec{x}-d=0[/math] ===> [math]E:\;\left(\begin{matrix}n_1\\n_2\\n_3\end{matrix}\right)\cdot p-d=0[/math] ===> [math]t= \; \frac{\vec{CAM} \;\vec{n} - d}{\vec{CAM} \; \vec{n} - \vec{x} \; \vec{n}} [/math] [br][br]t ∈ p found a point projected on E[br][br][math]Pcam:= \frac{ \left(d - \vec{CAM} \; \vec{n} \right) }{( \vec{x}-\vec{CAM} \; ) \; \vec{n}} [br] ( \vec{x}-\vec{CAM} \; ) + \vec{CAM}[br] [/math][br][br]writing as coordinate vector in matrix Mcam (denominator extracted and added in homogeneous CO) [br][br][math]Mcam \, := \, \left(\begin{array}{r}Cx \; n2 \; x2 + Cx \; n3 \; x3 - Cy \; n2 \; x1 - Cz \; n3 \; x1 - Cx \; d + d \; x1\\-Cx \; n1 \; x2 + Cy \; n1 \; x1 + Cy \; n3 \; x3 - Cz \; n3 \; x2 - Cy \; d + d \; x2\\-Cx \; n1 \; x3 - Cy \; n2 \; x3 + Cz \; n1 \; x1 + Cz \; n2 \; x2 - Cz \; d + d \; x3\\-Cx \; n1 - Cy \; n2 - Cz \; n3 + n1 \; x1 + n2 \; x2 + n3 \; x3\\\end{array}\right)[/math][br][br]transfering to matrix Pz[sub]H[/sub] in homogeneous coordinates [br][br][math]Pz_H \, := \, \left(\begin{array}{rrrr}-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\\\end{array}\right)[/math][br][br]Example CAM=(4,2,3) , E := 2x + y + z = 1[br][br][math]Z_H \, := \, \left(\begin{array}{rrrr}-4&4&4&-4\\4&-10&2&-2\\6&3&-9&-3\\2&1&1&-13\\\end{array}\right)[/math][br][br][br]CAM=(Cx,Cy,Cz) and plane n[sub]1 [/sub]x + n[sub]2[/sub] y + z n[sub]3 [/sub]= d[br][br]user-function-central-projection homogeneous coordinates[icon]/images/ggb/toolbar/mode_keepinput.png[/icon][br][code]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);[/code][br][br]Transfers[icon]/images/ggb/toolbar/mode_keepinput.png[/icon][br][code]HxT(AA):=Take(AA/Element(AA,4),1,3)[/code][br][code]TxH(AA):=Transpose(Flatten({Vector(AA)})+{0,0,0,1})[br]PointHP3d(aa):=(Element(Flatten(aa), 1),Element(Flatten(aa), 2),Element(Flatten(aa), 3))/Element(Flatten(aa), 4)[br]PointHv3d(aa):=Substitute(Vector((x,y,z)), {x,y,z}= Take(Flatten(aa),1,3)/Take(Flatten(aa),4,4))[br][br][br][/code][br][br]Test[br]K_[sub]CAM[/sub], Cube, E projektion plane[br]{A=vector((2,1,1)) , TxH(A) , Z_H TxH(A) , HxT(Z_H TxH(A))}[br][math] \left\{\left(\begin{array}{r}2\\1\\1\\\end{array}\right), \left(\begin{array}{r}2\\1\\1\\1\\\end{array}\right), \left(\begin{array}{r}-10\\10\\5\\-5\\\end{array}\right), \left(\begin{array}{r}2\\-2\\-1\\\end{array}\right) \right\} [/math][br][br]Test[br]CAM_[sub]Fig[/sub]Kamera, Fig Pointlist, FigZxy point image in plane z=0, FigZxy point image in plane y=0[br]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)[br]Z_y (projection matrix)[br]
camcarpet example projection to x1 x2 plane (x3=0)
vector in direction of projection[br]CAM=(cx,cy,cz)[sup]T[/sup] [br][br]We start with a projection line of a point (x1,x2,x3)[sup]T[/sup] of interrest in direction CAM[br][br] [math]p \, := \, X + t \; CAM[/math][br][br]intersept with a plane[br][br] [math]E:\;\left(\begin{matrix}n_1\\n_2\\n_3\end{matrix}\right)\cdot \vec{x}-d=0[/math] ===> [math]E:\;\left(\begin{matrix}n_1\\n_2\\n_3\end{matrix}\right)\cdot p-d=0[/math] ===> [math]t = \frac{d - n \; X}{n \; CAM} [/math] [br][br]t ∈ p found a point projected on E[br][br][math]Pcam \, := \, \frac{d - n \; X}{n \; CAM} \; CAM + X[/math][br][br]building images of base vectors X=e[sub]1[/sub],e[sub]2[/sub],e[sub]3[/sub] [br][br][math]Bcam \, :=\left(c_x \; \frac{d - n_1 \; x_1 - n_2 \; x_2 - n_3 \; x_3}{n_1 \; c_x + n_2 \; c_y + n_3 \; c_z} + x_1, c_y \; \frac{d - n_1 \; x_1 - n_2 \; x_2 - n_3 \; x_3}{n_1 \; c_x + n_2 \; c_y + n_3 \; c_z} + x_2, c_z \; \frac{d - n_1 \; x_1 - n_2 \; x_2 - n_3 \; x_3}{n_1 \; c_x + n_2 \; c_y + n_3 \; c_z} + x_3 \right)[/math][br][br]writing Bcam as matrix Pp[sub]H[/sub] in homogeneous coordinates [br][br][math]Pp_H \, := \frac{1}{c_x \; n_1 + c_y \; n_2 + c_z \; n_3} \; \left(\begin{array}{rrrr}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&1\\\end{array}\right)[/math][br][br]CAM=(cx,cy,cz) and plane n[sub]1 [/sub]x + n[sub]2[/sub] y + z n[sub]3 [/sub]= d[br][br]user-function parallel projection homogeneous coordinates[icon]/images/ggb/toolbar/mode_keepinput.png[/icon][br][code]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))}}[br][/code][br][br][math]PP_H(c_x, c_y, c_z, n_1, n_2, n_3, d) \, := \, \frac{1}{c_x \; n_1 + c_y \; n_2 + c_z \; n_3} \; \left(\begin{array}{rrrr}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\\\end{array}\right)[/math][br][br][br]Example: Pp_H( 2, 4, 3, 0, 1, 1, 1)[br][br][math]P_H:=\;\left(\begin{array}{rrrr}1&\frac{-2}{7}&\frac{-2}{7}&\frac{2}{7}\\0&\frac{3}{7}&\frac{-4}{7}&\frac{4}{7}\\0&\frac{-3}{7}&\frac{4}{7}&\frac{3}{7}\\0&0&0&1\\\end{array}\right)[/math][br][br]Transfers[icon]/images/ggb/toolbar/mode_keepinput.png[/icon] from/to homogeneous coordinates (vector/column matrix)[br][code]HxT(AA):=Take(AA/Element(AA,4),1,3)[/code][br][code]TxH(AA):=Transpose(Flatten({Vector(AA)})+{0,0,0,1})[/code]