3d projection

how can I project a 3dpoint correctly when its z is negative?
I would want to visualize correctly
a polygon also when is behind the observer

es:this this example produces an incorrect result.

Distance=2.56f // Distance of the observer

x=-0.5f // 3d x
y=-0.5f // 3d y
z=-2.50f // 3d z
Inverse=1.0f/(z+Distance); // reciprocal
Xp=(x*Distance)Inverse; //x projected
Distance)*Inverse; //y projected

thanks in advance

[This message has been edited by jeppa (edited 10-04-2001).]

As I understood you do the projection yourself already in eyespace. So any point with negativ z-value is behind the viewer. Your problem seems to be the “Inverse = 1.0f/(z+Distance);”. Try to do a “z = (float)fabs(z);”(or something like that) before you calculate the “Inverse”.


yes it know.when z is(-2.57f)the point 3d changes direction!!!And the polygon returns in the scene!

thanks in advace