camera3d
Class MathUtility

java.lang.Object
  extended bycamera3d.MathUtility

public final class MathUtility
extends java.lang.Object

Utility for performing some common vector math operations.

Version:
1.0
Author:
Fábio Roberto de Miranda, Carlos da Silva dos Santos

Method Summary
static void buildPlaneFromPointAndNormal(javax.vecmath.Vector4d plane, javax.vecmath.Point3d planePoint, javax.vecmath.Vector3d planeNormal)
          Creates the description of a plane that contains the point given as input and whose normal is determined by the input Vector3d argument.
static void buildPlaneFromPoints(javax.vecmath.Vector4d plane, javax.vecmath.Point3d p1, javax.vecmath.Point3d p2, javax.vecmath.Point3d p3)
          Creates the description of a plane that contains the three points given as input.
static double computeIntersection(javax.vecmath.Tuple3d result, javax.vecmath.Point3d linePoint, javax.vecmath.Vector3d lineVector, javax.vecmath.Point3d planePoint, javax.vecmath.Vector3d planeNormal)
           
static double computeIntersection(javax.vecmath.Tuple3d result, javax.vecmath.Point3d linePoint, javax.vecmath.Vector3d lineVec, javax.vecmath.Vector4d plane)
          Finds the intersection point between a plane and a line.
static void eulerToQuat(double roll, double pitch, double yaw, javax.vecmath.Quat4d quat)
          Transforms euler angles into the corresponding rotation quaternion.
static void generateRotQuat(TransformScope axis, double deltaAngle, javax.vecmath.Quat4d rotQuat)
          Description of the Method
static void planeToPointAndNormal(javax.vecmath.Vector4d plane, javax.vecmath.Vector3d planeNormal, javax.vecmath.Point3d planePoint)
          Converts a plane in the form Ax + By + Cz + D = 0 to a plane represented by a normal and a point
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

buildPlaneFromPoints

public static void buildPlaneFromPoints(javax.vecmath.Vector4d plane,
                                        javax.vecmath.Point3d p1,
                                        javax.vecmath.Point3d p2,
                                        javax.vecmath.Point3d p3)
Creates the description of a plane that contains the three points given as input. The input points (p1, p2 and p3) are supposed to arrive in world coordinates, and must be non colinear. The plane description is placed in the Vector4d passed in as input. A point (a,b,c) belongs to the plane if it obeys the following equation: a*plane.x + b*plane.y + c*plane.z + plane.w = 0 In case it's necessary to obtain the normal to the plane, all that is required is assembling a vector with the (x,y,z) componentes of the plane Vector4d.

Parameters:
plane - receives the plane equation parameters.
p1 - first point belonging to the plane.
p2 - second point belonging to the plane.
p3 - third point belonging to the plane.

buildPlaneFromPointAndNormal

public static void buildPlaneFromPointAndNormal(javax.vecmath.Vector4d plane,
                                                javax.vecmath.Point3d planePoint,
                                                javax.vecmath.Vector3d planeNormal)
Creates the description of a plane that contains the point given as input and whose normal is determined by the input Vector3d argument. The input points is supposed to arrive in world coordinates. The plane description is placed in the Vector4d passed in as input. A point (a,b,c) belongs to the plane if it obeys the following equation: a*plane.x + b*plane.y + c*plane.z + plane.w = 0

Parameters:
plane - receives the plane equation parameters.
planePoint - point belonging to the plane.
planeNormal - vector normal to desired plane.

computeIntersection

public static double computeIntersection(javax.vecmath.Tuple3d result,
                                         javax.vecmath.Point3d linePoint,
                                         javax.vecmath.Vector3d lineVec,
                                         javax.vecmath.Vector4d plane)
Finds the intersection point between a plane and a line. The plane is defined by a Vector4d holding the parameters of the plane equation. The line is defined by one of its points and its direction vector.

Parameters:
result - receives the resultant intersection point.
linePoint - point belonging to line
lineVec - line direction
plane - Vector4d equation of the plane in the form Ax + By + Cz + D = 0
Returns:
the scalar to multiply lineVector so that: scalar * lineVector + linePoint = intersection

planeToPointAndNormal

public static void planeToPointAndNormal(javax.vecmath.Vector4d plane,
                                         javax.vecmath.Vector3d planeNormal,
                                         javax.vecmath.Point3d planePoint)
Converts a plane in the form Ax + By + Cz + D = 0 to a plane represented by a normal and a point

Parameters:
plane - is the Ax + By + Cz + D representation of the plan
planeNormal - is the resulting plane normal (Bet you could've guessed that :) )
planePoint - is a point belonging to the plane

computeIntersection

public static double computeIntersection(javax.vecmath.Tuple3d result,
                                         javax.vecmath.Point3d linePoint,
                                         javax.vecmath.Vector3d lineVector,
                                         javax.vecmath.Point3d planePoint,
                                         javax.vecmath.Vector3d planeNormal)
Parameters:
result - is the point to contain the result
linePoint - and
lineVector - are line parameters,
planePoint - and
planeNormal - are the parameters of the plane
Returns:
the scalar to multiply lineVector so that: scalar * lineVector + linePoint = intersection *

generateRotQuat

public static void generateRotQuat(TransformScope axis,
                                   double deltaAngle,
                                   javax.vecmath.Quat4d rotQuat)
Description of the Method

Parameters:
axis - Description of the Parameter
deltaAngle - Description of the Parameter
rotQuat - Description of the Parameter

eulerToQuat

public static void eulerToQuat(double roll,
                               double pitch,
                               double yaw,
                               javax.vecmath.Quat4d quat)
Transforms euler angles into the corresponding rotation quaternion. The order in which rotations are applied is: roll(X axii)-->pitch(Y axii)--> yaw(Z axii) Extracted from Nick Bobick's Gamasutra Code.

Parameters:
roll - rotation around x axis (radians).
pitch - rotation around y axis (radians).
yaw - rotation around z axis (radians).
quat - Description of the Parameter


Copyright © 2001-2003 F.R. Miranda, C.S. Santos, J.E. Kogler Jr.. All Rights Reserved.