Example.py
//from Mathematics for 3D Game Programming Third Edition
// Eric Lengyel... (Polyboard keyword...)
#size = 50.
#cam_pos
#vec3( 0, 0, -1920 )
#near
#0.0001
#far
#3840
#GLM::::
P1 = glm.vec3(-size,0.,0.)
P2 = glm.vec3(-size,0.,0.)
P3 = glm.vec3(0.,size,0.)
P4 = glm.vec3(-size,0.,0.)
r=.01;
C = camera.cam_pos;
Z1 = (C-P1)/(glm.normalize(C-P1));
Z2 = (C-P2)/(glm.normalize(C-P2));
Z3 = (C-P3)/(glm.normalize(C-P3));
Z4 = (C-P4)/(glm.normalize(C-P4));
T1 = (P2-P1)/(glm.normalize(P2-P1));
T2 = (P3-P2)/(glm.normalize(P3-P2));
T3 = (P4-P3)/(glm.normalize(P4-P3));
T4 = (P4-P3)/(glm.normalize(P4-P3));
G1 = P1 + r*(glm.cross(T1,Z1));
H1 = P1 - r*(glm.cross(T1,Z1));
G2 = P2 + r*(glm.cross(T2,Z2));
H2 = P2 - r*(glm.cross(T2,Z2));
G3 = P3 + r*(glm.cross(T3,Z3));
H3 = P3 - r*(glm.cross(T3,Z3));
G4 = P4 + r*(glm.cross(T4,Z4));
H4 = P4 - r*(glm.cross(T4,Z4));
So far after investigating G1 I am finding that G1’s components are assigned vec3( -nan(ind), -nan(ind), -nan(ind) ).
So then in my effort to transcribe the algorithm from the book annotated in my comment block I am getting nan (not a number?). I feel a bit lost so far, and after lookingover things so far I don’t really have an understanding as to why things are showing up nan however it seems that G1 should describe a vertices offset from one of the triangles vertices. Anyone know why the nan is showing up and maybe how to get the correct point at G1 to start to come forth from the glm system (or some other way to?)?