EigenMeat.EigenMaze
Class Math3D

java.lang.Object
  extended byEigenMeat.EigenMaze.Math3D

public class Math3D
extends java.lang.Object

3d math methods.


Constructor Summary
Math3D()
          Default constructor.
 
Method Summary
static Vect3d calculateNormal(Vect3d v1, Vect3d v2, Vect3d v3)
          Calculates normal of a triangle.
static boolean doesLineIntersectAABCube(Vect3d cen, float radius, Vect3d p1, Vect3d p2)
          Checks to see if line intersects an axis aligned bounding cube.
static Vect3d getCollisionPointWithPlane(Plane plane, Vect3d point, Vect3d direction)
          Gets the collision point between a plane and a vector.
static Vect3d getCollisionPointWithPlane(Vect3d planeNormal, float distance, Vect3d point, Vect3d direction)
          Gets the collision point between a plane and a vector.
static float getPlaneDistance(Vect3d planeNormal, Vect3d pointOnPlane)
          Get plane distance to the origin of a specified plane.
static float getPointDistanceFromPlane(Vect3d planeNormal, float distance, Vect3d point)
          Get the distance a point is from a plane.
static boolean isPointInFrontOfPlane(Vect3d planeNormal, float distance, Vect3d point)
          Checks to see if a point is in front of a plane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Math3D

public Math3D()
Default constructor.

Method Detail

getPlaneDistance

public static float getPlaneDistance(Vect3d planeNormal,
                                     Vect3d pointOnPlane)
Get plane distance to the origin of a specified plane.

Parameters:
planeNormal - normal of the plane
pointOnPlane - a point of on the plane
Returns:
plane distance

getPointDistanceFromPlane

public static float getPointDistanceFromPlane(Vect3d planeNormal,
                                              float distance,
                                              Vect3d point)
Get the distance a point is from a plane.

Parameters:
planeNormal - normal of a plane
distance - plane distance of the plane
point - to check
Returns:
distance

isPointInFrontOfPlane

public static boolean isPointInFrontOfPlane(Vect3d planeNormal,
                                            float distance,
                                            Vect3d point)
Checks to see if a point is in front of a plane.

Parameters:
planeNormal - normal of plane
distance - plane distance of plane
point - point to check
Returns:
true if point is in front of plane, else false

getCollisionPointWithPlane

public static Vect3d getCollisionPointWithPlane(Plane plane,
                                                Vect3d point,
                                                Vect3d direction)
Gets the collision point between a plane and a vector.

Parameters:
plane - a plane
point - starting point of vector
direction - direction of vector
Returns:
collision point

getCollisionPointWithPlane

public static Vect3d getCollisionPointWithPlane(Vect3d planeNormal,
                                                float distance,
                                                Vect3d point,
                                                Vect3d direction)
Gets the collision point between a plane and a vector.

Parameters:
planeNormal - plane normal
distance - plane distance
point - starting point of vector
direction - vector direction
Returns:
collision point

doesLineIntersectAABCube

public static boolean doesLineIntersectAABCube(Vect3d cen,
                                               float radius,
                                               Vect3d p1,
                                               Vect3d p2)
Checks to see if line intersects an axis aligned bounding cube.

Parameters:
cen - cube center
radius - cube size
p1 - start point of line
p2 - end point of line
Returns:
true of line intersects cube, else false

calculateNormal

public static Vect3d calculateNormal(Vect3d v1,
                                     Vect3d v2,
                                     Vect3d v3)
Calculates normal of a triangle.

Parameters:
v1 - first vertex
v2 - second vertex
v3 - third vertex
Returns:
normal