Polyboard geometry shader. Finding point G1

Given these values:

size=250.
P1 =    -size,0.,0.
P2 =    size,0.,0.
P3 =    0.,size,0.
P4 =    -size,0.,0.


camPos = glm.vec3(.1,.1,-1920.)
near=0.0001
far=3840.

I developed a geometry shader so far:

#version 410

#define MAX_VERTICES 256
//#define EPSILON 0.0000000000000002220446049250313
#define EPSILON 0.1
layout(lines_adjacency) in;
layout(triangle_strip, max_vertices = MAX_VERTICES) out;

out vec4 aColor;

uniform float near; 
uniform float far; 
uniform vec3 camPos;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

vec3 nzero(vec3 P) {
    if(P[0]<=EPSILON) {
        P[0] = EPSILON;
    }

    if(P[0]<=EPSILON) {
        P[1] = EPSILON;
    }
    
    if(P[0]<=EPSILON) {
        P[2] = EPSILON;
    }
    return P;
}
//Mathematics for 3D Game Programming Third Edition
// Eric Lengyel... (Polyboard keyword...)
void main(void)
{

int i = 0;
vec3 P1 = vec3(gl_in[i].gl_Position.x,gl_in[i].gl_Position.y,gl_in[i].gl_Position.z); 
i = 1;
vec3 P2 = vec3(gl_in[i].gl_Position.x,gl_in[i].gl_Position.y,gl_in[i].gl_Position.z); 
i = 2;
vec3 P3 = vec3(gl_in[i].gl_Position.x,gl_in[i].gl_Position.y,gl_in[i].gl_Position.z); 
i = 3;
vec3 P4 = vec3(gl_in[i].gl_Position.x,gl_in[i].gl_Position.y,gl_in[i].gl_Position.z); 


float r=.01;
vec3 C = camPos;
C = nzero(camPos);

vec3 Z1 = nzero(C-P1)    /    normalize(nzero(C-P1))    ;
vec3 Z2 = nzero(C-P2)    /    normalize(nzero(C-P2) )   ;
vec3 Z3 = nzero(C-P3)    /    normalize(nzero(C-P3) )   ;
vec3 Z4 = nzero(C-P4)    /    normalize(nzero(C-P4) )   ;

vec3 T1 = P2-P1 / normalize(nzero(P2-P1) )   ;
vec3 T2 = P3-P2 / normalize(nzero(P3-P2) )   ;
vec3 T3 = P4-P3 / normalize(nzero(P4-P3)  )  ;
vec3 T4 = P4-P3 / normalize(nzero(P4-P3)  )  ;

vec3 G1 = P1 + r*(cross(T1,Z1));




aColor = vec4(0.0, 1.0, 0.9686, 1.0);
gl_Position = projection*view*model* vec4(C,1.0) + vec4(-r,0,0,0);
EmitVertex(); 
gl_Position =projection*view*model* vec4(C,1.0)+ vec4(r,0,0,0);
EmitVertex(); 
gl_Position = projection*view*model* vec4(C,1.0)+ vec4(0,r,0,0);
EmitVertex(); 
EndPrimitive();


aColor = vec4(0.8353, 0.8431, 0.1647, 1.0);
gl_Position = projection*view*model* vec4(Z1,1.0) + vec4(-r,0,0,0);
EmitVertex(); 
gl_Position =projection*view*model* vec4(Z1,1.0)+ vec4(r,0,0,0);
EmitVertex(); 
gl_Position = projection*view*model* vec4(Z1,1.0)+ vec4(0,r,0,0);
EmitVertex(); 
EndPrimitive();


aColor = vec4(0.8196, 0.1647, 0.8431, 1.0);
gl_Position = projection*view*model* vec4(T1,1.0) + vec4(-r,0,0,0);
EmitVertex(); 
gl_Position =projection*view*model* vec4(T1,1.0)+ vec4(r,0,0,0);
EmitVertex(); 
gl_Position = projection*view*model* vec4(T1,1.0)+ vec4(0,r,0,0);
EmitVertex(); 
EndPrimitive();


aColor = vec4(0.76, 0.1, 0.1, 1.0);
gl_Position = projection*view*model* vec4(G1,1.0) + vec4(-r,0,0,0);
EmitVertex(); 
gl_Position =projection*view*model* vec4(G1,1.0)+ vec4(r,0,0,0);
EmitVertex(); 
gl_Position = projection*view*model* vec4(G1,1.0)+ vec4(0,r,0,0);
EmitVertex(); 
EndPrimitive();




}

So then, I have a C and a Z1 drawn to the window to look at. So far I do not have a T1 or a G1 being drawn by the geometry shader. G1 is the most important point and should be a vertex offset of the line by amount r of Eric Lengyel’s algorithm (Mathematics for 3D Game Programming Third Edition, Polyboard).

Is there something maybe that I have missed or misinterpreted? Does anyone know how to get G1 drawing correctly?

My misunderstanding there… It looks to me so far that in terms of symbolic notation a vector length P2-P1 is talked about as opposed to a normalization that I had thought was meant.