# lemniscate of Bernoulli [closed]

I am trying to learn and teach myself openGL and I wanted to draw a figure 8 in a 3D setting but I'm having a problem. Please forgive me, I am very new at this but I'll attempt to explain what I have done so far

I understand that I can use the Lemniscate of Bernoulli to draw a nice figure 8, so I've have adopted that idea into my code. I just want to draw it along the x and z plane. My code looks like this

#define PI 3.1415926535f
#define MAX_STEPS 100.0f
//...
Vector3 PointOnCurve1(Vector3 p1, float t)
{
Vector3 tempPoint = {0.0f, 0.0f, 0.0f};
float scaler = 2/ (3- cos(2*t));

varX = scaler * cos(t);
varZ = scaler * sin(2*t) / 2

tempPoint.x = varX+p1.x;
tempPoint.y += p1.y;
tempPoint.z =varX+p1.z;

return tempPoint;
}

Vector3 g_Point    = {-4,  0,  0};
glBegin(GL_LINE_STRIP);
for(float t = -PI; t <= PI; t += PI / MAX_STEPS)
{
vPoint = PointOnCurve1(g_Point, t);
glVertex3f(vPoint.x, vPoint.y, vPoint.z);
}

glEnd();


All I'm getting is one straight green line instead of a figure 8. any ideas? Am I missing something here? I'm basing this equation from this gamedev article

How can I move an object in an "infinity" or "figure 8" trajectory?

Avoiding this mistake can be helped by using vector operations where possible, like p1 + var where var is a vector instead of varX and varZ.