projection onto hemisphere

maybe this question doesn’t belong in this forum but I was trying to do this in opengl for a trackball so…

I was wondering if someone could explain this code I found for projecting 2D points onto a hemisphere…especially the (*) parts

Vec3f v;
float d;
() v.x = (2.0point.x - windowSize.x) / windowSize.x;
() v.y = (windowSize.y - 2.0point.y) / windowSize.y;
v.z = 0.0;
d = v.Length();
d = (d<1.0) ? d : 1.0;
() v.z = sqrtf(1.001 - dd);
v.Normalize(); // Still need to normalize, since we only capped d, not v.
return v;


it appears that Vec3f is a structure/class with 3 pointers to floats, i.e.:

typedef struct
float *x;
float *y;
float *z;

the (*) before each value is dereferncing the pointer in order to assign a value to it. although, the line v.z = 0.0; seems to debunk my theory, that might not cause a compiler error.


I don’t think the (*)'s belong to the code, they can be more like notes that refer to comments on the code.