Previous   |  Next   |  Back to Technical Manual Index

3.5. Module: GlMath

-Class Hierarchy

          GlMath is not a subclass of any other class.

           Developed by Kwan Skinner


At a high level, this class contains all the required math functions required to compute the normal of a given triangle.  All these functions are contained within one method named Normal() which takes three GLpoints as arguments.  A GLpoint contains the information necessary to represent a point in three-space.
-Implementation Details
The normal of a triangle is computed from the verticies of a triangle as follows.  First two vectors representing these three points are computed by taking the difference of any two sets of two verticies.  For this method's purposes, v2 - v1 and v3 - v2 are computed, where v1, v2, and v3 are the verticies passed to this method.  Next the cross product of these two vectors are computed to yield a third vector that is orthogonal to the the other two verticies.  Finally this vector is normalized by computing the length of the result of the cross product operation, the cross product vector, and dividing each of the x, y and z coordinates of the cross product vector by this length.  This result is then returned as the result of this method.

Previous  |  Back to Technical Manual Index