org.ogre4j
Class Math

java.lang.Object
  extended by org.xbig.base.NativeObject
      extended by org.ogre4j.Math
All Implemented Interfaces:
IMath, INativeObject

public class Math
extends NativeObject
implements IMath


Nested Class Summary
static class Math.AngleUnit
           
 
Field Summary
 
Fields inherited from class org.xbig.base.NativeObject
deleted, object, remote
 
Constructor Summary
  Math(InstancePointer p)
          This constructor is public for internal useage only!
protected Math(InstancePointer p, boolean remote)
          Creates a Java wrapper object for an existing C++ object.
  Math(long trigTableSize)
          Default constructor.
  Math(WithoutNativeObject val)
          Allows creation of Java objects without C++ objects.
 
Method Summary
static float Abs(float fValue)
           
static void Abs(IDegree returnValue, IDegree dValue)
           
static void Abs(IRadian returnValue, IRadian rValue)
           
static void ACos(IRadian returnValue, float fValue)
           
static float AngleUnitsToDegrees(float units)
          Convert from the current AngleUnit to degrees.
static float AngleUnitsToRadians(float units)
          Convert from the current AngleUnit to radians.
static void ASin(IRadian returnValue, float fValue)
           
static void ATan(IRadian returnValue, float fValue)
           
static void ATan2(IRadian returnValue, float fY, float fX)
           
static void buildReflectionMatrix(IMatrix4 returnValue, IPlane p)
          Build a reflection matrix for the passed in plane.
static void calculateBasicFaceNormal(IVector3 returnValue, IVector3 v1, IVector3 v2, IVector3 v3)
          Calculate a face normal, no w-information.
static void calculateBasicFaceNormalWithoutNormalize(IVector3 returnValue, IVector3 v1, IVector3 v2, IVector3 v3)
          Calculate a face normal without normalize, no w-information.
static void calculateFaceNormal(IVector4 returnValue, IVector3 v1, IVector3 v2, IVector3 v3)
          Calculate a face normal, including the w component which is the offset from the origin.
static void calculateFaceNormalWithoutNormalize(IVector4 returnValue, IVector3 v1, IVector3 v2, IVector3 v3)
          Calculate a face normal without normalize, including the w component which is the offset from the origin.
static void calculateTangentSpaceVector(IVector3 returnValue, IVector3 position1, IVector3 position2, IVector3 position3, float u1, float v1, float u2, float v2, float u3, float v3)
          Calculates the tangent space vector for a given set of positions / texture coords.
static float Ceil(float fValue)
           
static float Cos(float fValue, boolean useTables)
          Cosine function.
static float Cos(IRadian fValue, boolean useTables)
          Cosine function.
static float DegreesToAngleUnits(float degrees)
          Convert from degrees to the current AngleUnit.
static float DegreesToRadians(float degrees)
           
 void delete()
          Deletes the corresponding C++ object.
static float Exp(float fValue)
           
 void finalize()
           
static float Floor(float fValue)
           
static float gaussianDistribution(float x, float offset, float scale)
          Generates a value based on the Gaussian (normal) distribution function with the given offset and scale parameters.
static Math.AngleUnit getAngleUnit()
          Get the unit being used for angles.
static float getfDeg2Rad()
           
static float getfRad2Deg()
           
static float getHALF_PI()
           
static float getNEG_INFINITY()
           
static float getPI()
           
static float getPOS_INFINITY()
           
static float getTWO_PI()
           
static int IAbs(int iValue)
           
static int ICeil(float fValue)
           
static int IFloor(float fValue)
           
static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue, IRay ray, IAxisAlignedBox box)
          / box intersection, returns boolean result and distance.
static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue, IRay ray, Ilist<IPlane> planeList, boolean normalIsOutside)
          / convex plane list intersection test.
static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue, IRay ray, IPlane plane)
          / plane intersection, returns boolean result and distance.
static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue, IRay ray, ISphere sphere, boolean discardInside)
          / sphere intersection, returns boolean result and distance.
static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue, IRay ray, Ivector<IPlane> planeList, boolean normalIsOutside)
          / convex plane list intersection test.
static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue, IRay ray, IVector3 a, IVector3 b, IVector3 c, boolean positiveSide, boolean negativeSide)
          / triangle intersection, returns boolean result and distance.
static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue, IRay ray, IVector3 a, IVector3 b, IVector3 c, IVector3 normal, boolean positiveSide, boolean negativeSide)
          / triangle intersection, returns boolean result and distance.
static boolean intersects(IPlane plane, IAxisAlignedBox box)
          / box intersection test.
static boolean intersects(IRay ray, IAxisAlignedBox box, FloatPointer d1, FloatPointer d2)
          / box intersection, returns boolean result and two intersection distance.
static boolean intersects(ISphere sphere, IAxisAlignedBox box)
          / box intersection test.
static boolean intersects(ISphere sphere, IPlane plane)
          / plane intersection test.
static float InvSqrt(float fValue)
          Inverse square root i.e. 1 / Sqrt(x), good for vector normalisation.
static int ISign(int iValue)
           
static float Log(float fValue)
           
static void makeViewMatrix(IMatrix4 returnValue, IVector3 position, IQuaternion orientation, IMatrix4 reflectMatrix)
           
static boolean pointInTri2D(IVector2 p, IVector2 a, IVector2 b, IVector2 c)
          Checks whether a given point is inside a triangle, in a 2-dimensional (Cartesian) space.
static boolean pointInTri3D(IVector3 p, IVector3 a, IVector3 b, IVector3 c, IVector3 normal)
          Checks whether a given 3D point is inside a triangle.
static float Pow(float fBase, float fExponent)
           
static float RadiansToAngleUnits(float radians)
          Convert from radians to the current AngleUnit .
static float RadiansToDegrees(float radians)
           
static float RangeRandom(float fLow, float fHigh)
           
static boolean RealEqual(float a, float b, float tolerance)
          Compare 2 reals, using tolerance for inaccuracies.
static void setAngleUnit(Math.AngleUnit unit)
          These functions used to set the assumed angle units (radians or degrees) expected when using the type.
static float Sign(float fValue)
           
static void Sign(IDegree returnValue, IDegree dValue)
           
static void Sign(IRadian returnValue, IRadian rValue)
           
static float Sin(float fValue, boolean useTables)
          Sine function.
static float Sin(IRadian fValue, boolean useTables)
          Sine function.
static float Sqr(float fValue)
           
static float Sqrt(float fValue)
           
static void Sqrt(IDegree returnValue, IDegree fValue)
           
static void Sqrt(IRadian returnValue, IRadian fValue)
           
static float SymmetricRandom()
           
static float Tan(float fValue, boolean useTables)
          Tangent function.
static float Tan(IRadian fValue, boolean useTables)
          Tangent function.
static float UnitRandom()
           
 
Methods inherited from class org.xbig.base.NativeObject
disconnectFromNativeObject, equals, getInstancePointer, hashCode, setInstancePointer, setInstancePointer, setInstancePointer, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xbig.base.INativeObject
disconnectFromNativeObject, getInstancePointer, setInstancePointer, setInstancePointer, setInstancePointer
 

Constructor Detail

Math

public Math(InstancePointer p)
This constructor is public for internal useage only! Do not use it!


Math

protected Math(InstancePointer p,
               boolean remote)
Creates a Java wrapper object for an existing C++ object. If remote is set to 'true' this object cannot be deleted in Java.


Math

public Math(WithoutNativeObject val)
Allows creation of Java objects without C++ objects.

See Also:
WithoutNativeObject, INativeObject.disconnectFromNativeObject()

Math

public Math(long trigTableSize)
Default constructor.

Method Detail

delete

public void delete()
Description copied from interface: INativeObject
Deletes the corresponding C++ object.

Subclasses must implement this but if the native instance was created by the underlying library the native call to dispose must not happen!

Specified by:
delete in interface INativeObject
Specified by:
delete in class NativeObject
See Also:
#remote

finalize

public void finalize()
Overrides:
finalize in class NativeObject

IAbs

public static int IAbs(int iValue)

ICeil

public static int ICeil(float fValue)

IFloor

public static int IFloor(float fValue)

ISign

public static int ISign(int iValue)

Abs

public static float Abs(float fValue)

Abs

public static void Abs(IDegree returnValue,
                       IDegree dValue)

Abs

public static void Abs(IRadian returnValue,
                       IRadian rValue)

ACos

public static void ACos(IRadian returnValue,
                        float fValue)

ASin

public static void ASin(IRadian returnValue,
                        float fValue)

ATan

public static void ATan(IRadian returnValue,
                        float fValue)

ATan2

public static void ATan2(IRadian returnValue,
                         float fY,
                         float fX)

Ceil

public static float Ceil(float fValue)

Cos

public static float Cos(IRadian fValue,
                        boolean useTables)
Cosine function.


Cos

public static float Cos(float fValue,
                        boolean useTables)
Cosine function.


Exp

public static float Exp(float fValue)

Floor

public static float Floor(float fValue)

Log

public static float Log(float fValue)

Pow

public static float Pow(float fBase,
                        float fExponent)

Sign

public static float Sign(float fValue)

Sign

public static void Sign(IRadian returnValue,
                        IRadian rValue)

Sign

public static void Sign(IDegree returnValue,
                        IDegree dValue)

Sin

public static float Sin(IRadian fValue,
                        boolean useTables)
Sine function.


Sin

public static float Sin(float fValue,
                        boolean useTables)
Sine function.


Sqr

public static float Sqr(float fValue)

Sqrt

public static float Sqrt(float fValue)

Sqrt

public static void Sqrt(IRadian returnValue,
                        IRadian fValue)

Sqrt

public static void Sqrt(IDegree returnValue,
                        IDegree fValue)

InvSqrt

public static float InvSqrt(float fValue)
Inverse square root i.e. 1 / Sqrt(x), good for vector normalisation.


UnitRandom

public static float UnitRandom()

RangeRandom

public static float RangeRandom(float fLow,
                                float fHigh)

SymmetricRandom

public static float SymmetricRandom()

Tan

public static float Tan(IRadian fValue,
                        boolean useTables)
Tangent function.


Tan

public static float Tan(float fValue,
                        boolean useTables)
Tangent function.


DegreesToRadians

public static float DegreesToRadians(float degrees)

RadiansToDegrees

public static float RadiansToDegrees(float radians)

setAngleUnit

public static void setAngleUnit(Math.AngleUnit unit)
These functions used to set the assumed angle units (radians or degrees) expected when using the type.


getAngleUnit

public static Math.AngleUnit getAngleUnit()
Get the unit being used for angles.


AngleUnitsToRadians

public static float AngleUnitsToRadians(float units)
Convert from the current AngleUnit to radians.


RadiansToAngleUnits

public static float RadiansToAngleUnits(float radians)
Convert from radians to the current AngleUnit .


AngleUnitsToDegrees

public static float AngleUnitsToDegrees(float units)
Convert from the current AngleUnit to degrees.


DegreesToAngleUnits

public static float DegreesToAngleUnits(float degrees)
Convert from degrees to the current AngleUnit.


pointInTri2D

public static boolean pointInTri2D(IVector2 p,
                                   IVector2 a,
                                   IVector2 b,
                                   IVector2 c)
Checks whether a given point is inside a triangle, in a 2-dimensional (Cartesian) space.


pointInTri3D

public static boolean pointInTri3D(IVector3 p,
                                   IVector3 a,
                                   IVector3 b,
                                   IVector3 c,
                                   IVector3 normal)
Checks whether a given 3D point is inside a triangle.


intersects

public static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue,
                              IRay ray,
                              IPlane plane)
/ plane intersection, returns boolean result and distance.


intersects

public static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue,
                              IRay ray,
                              ISphere sphere,
                              boolean discardInside)
/ sphere intersection, returns boolean result and distance.


intersects

public static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue,
                              IRay ray,
                              IAxisAlignedBox box)
/ box intersection, returns boolean result and distance.


intersects

public static boolean intersects(IRay ray,
                                 IAxisAlignedBox box,
                                 FloatPointer d1,
                                 FloatPointer d2)
/ box intersection, returns boolean result and two intersection distance.


intersects

public static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue,
                              IRay ray,
                              IVector3 a,
                              IVector3 b,
                              IVector3 c,
                              IVector3 normal,
                              boolean positiveSide,
                              boolean negativeSide)
/ triangle intersection, returns boolean result and distance.


intersects

public static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue,
                              IRay ray,
                              IVector3 a,
                              IVector3 b,
                              IVector3 c,
                              boolean positiveSide,
                              boolean negativeSide)
/ triangle intersection, returns boolean result and distance.


intersects

public static boolean intersects(ISphere sphere,
                                 IAxisAlignedBox box)
/ box intersection test.


intersects

public static boolean intersects(IPlane plane,
                                 IAxisAlignedBox box)
/ box intersection test.


intersects

public static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue,
                              IRay ray,
                              Ivector<IPlane> planeList,
                              boolean normalIsOutside)
/ convex plane list intersection test.


intersects

public static void intersects(Ipair<java.lang.Boolean,java.lang.Float> returnValue,
                              IRay ray,
                              Ilist<IPlane> planeList,
                              boolean normalIsOutside)
/ convex plane list intersection test.


intersects

public static boolean intersects(ISphere sphere,
                                 IPlane plane)
/ plane intersection test.


RealEqual

public static boolean RealEqual(float a,
                                float b,
                                float tolerance)
Compare 2 reals, using tolerance for inaccuracies.


calculateTangentSpaceVector

public static void calculateTangentSpaceVector(IVector3 returnValue,
                                               IVector3 position1,
                                               IVector3 position2,
                                               IVector3 position3,
                                               float u1,
                                               float v1,
                                               float u2,
                                               float v2,
                                               float u3,
                                               float v3)
Calculates the tangent space vector for a given set of positions / texture coords.


buildReflectionMatrix

public static void buildReflectionMatrix(IMatrix4 returnValue,
                                         IPlane p)
Build a reflection matrix for the passed in plane.


calculateFaceNormal

public static void calculateFaceNormal(IVector4 returnValue,
                                       IVector3 v1,
                                       IVector3 v2,
                                       IVector3 v3)
Calculate a face normal, including the w component which is the offset from the origin.


calculateBasicFaceNormal

public static void calculateBasicFaceNormal(IVector3 returnValue,
                                            IVector3 v1,
                                            IVector3 v2,
                                            IVector3 v3)
Calculate a face normal, no w-information.


calculateFaceNormalWithoutNormalize

public static void calculateFaceNormalWithoutNormalize(IVector4 returnValue,
                                                       IVector3 v1,
                                                       IVector3 v2,
                                                       IVector3 v3)
Calculate a face normal without normalize, including the w component which is the offset from the origin.


calculateBasicFaceNormalWithoutNormalize

public static void calculateBasicFaceNormalWithoutNormalize(IVector3 returnValue,
                                                            IVector3 v1,
                                                            IVector3 v2,
                                                            IVector3 v3)
Calculate a face normal without normalize, no w-information.


gaussianDistribution

public static float gaussianDistribution(float x,
                                         float offset,
                                         float scale)
Generates a value based on the Gaussian (normal) distribution function with the given offset and scale parameters.


makeViewMatrix

public static void makeViewMatrix(IMatrix4 returnValue,
                                  IVector3 position,
                                  IQuaternion orientation,
                                  IMatrix4 reflectMatrix)

getPOS_INFINITY

public static float getPOS_INFINITY()

getNEG_INFINITY

public static float getNEG_INFINITY()

getPI

public static float getPI()

getTWO_PI

public static float getTWO_PI()

getHALF_PI

public static float getHALF_PI()

getfDeg2Rad

public static float getfDeg2Rad()

getfRad2Deg

public static float getfRad2Deg()


Copyright © 2007 netAllied GmbH. All Rights Reserved.