by Tom Plunket <gamedev@[EMAIL PROTECTED]
>
Aug 17, 2007 at 09:08 PM
bob wrote:
> Vertex2d a2d;
>
> a2d.x = a.x / a.z * SCREENWIDTH;
> a2d.y = -a.y / a.z * SCREENHEIGHT;
>
> a2d.x = a2d.x/2.0f + SCREENWIDTH/2.0;
> a2d.y = a2d.y/2.0f + SCREENHEIGHT/2.0;
(I'd suggest adding parentheses to make the order of operations
explicit.)
"Right" depends on what exactly you're trying to accomplish. Certainly
this will transform points from one set of values to another.
Doing the algebra, (I think) this is the same as:
a2d.x = (((a.x * width) / a.z) + width) / 2
Is this what you intend, and what effect are you looking for?
-tom!
--