Scwizzo's Game Updates
| Home |


Ray-Plane Intersection & Vec3 Class
May 13th, 2009

After spendng some time working on a Ray-Plane intersection test I got the portion working correctly for the ray. I have not really tried implementing an effective way of testing which triangle the ray intersection, however I tried testing every triangle rendered, and well... that's not efficient now is it ;) Here are some pictures of the ray when clicked at the spot, then the camera rotated/moved so the ray can be seen.
Ray as seen head on (not visible)
Ray as seen from an angle (visible)

I also worked on creating a class Vec3 so I can do easy calculations of a vector. Previously I was using typedef double vec3[3] (lower case) which was getting tedious to do all the X, Y, and Z calculations one at a time. So the class Vec3 (upper case) was born. I tried multiple ways of doing this. First was with a 3 element double array (double Vect3[3]) and that gave numerous problems with memory leaks when overloading the operators. The second was to use a vector Vect3, and that too proved to be inefficient as the operators seemed to slow things down. I compared the vector to vec3 type definition and the vec3 C-style array gave me some more frames per second back that the vector just could not seem to get. Lastly I just defined the X, Y, and Z coordinates to be all independant variables. This worked a lot better. The frames per second were in between the vector and the vec3 type definition. A fair compromise.

The documentation for my Vec3 class can be downloaded here.


Hosted by www.Geocities.ws

1