crystalspace.jbind.impl.csgeom.math3d_d
Class csDVector3

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csgeom.math3d_d.csDVector3
All Implemented Interfaces:
iPointer

public class csDVector3
extends csNativeObject

A 3D vector.

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csDVector3()
          Make a new vector.
csDVector3(csDVector3 v)
          Copy Constructor.
csDVector3(csVector3 v)
          Conversion from single precision vector to double.
csDVector3(double m)
          Make a new initialized vector.
csDVector3(double ix, double iy)
          Make a new vector and initialize with the given values.
csDVector3(double ix, double iy, double iz)
          Make a new vector and initialize with the given values.
csDVector3(iPointer nPointer)
          Create a java csDVector3 object which points to the native csDVector3 nPointer.
 
Method Summary
 csDVector3 add()
          Unary + operator.
 csDVector3 add(csDVector3 v)
          Add another vector to this vector.
static csDVector3 add(csDVector3 v1, csDVector3 v2)
          Add two vectors.
 void cross(csDVector3 px, csDVector3 py)
          Take cross product of two vectors and put result in this vector.
static csDVector3 div(csDVector3 v, double f)
          Divide a vector by a scalar.
 csDVector3 div(double f)
          Divide this vector by a scalar.
static boolean equals(csDVector3 v1, csDVector3 v2)
          Check if two vectors are equal.
 boolean equals(java.lang.Object obj)
          Check if two vectors are equal.
static boolean greater(double f, csDVector3 v)
          Test if each component of a vector is greater than a small epsilon value.
protected  boolean isNativePointerValidSafe(long nPointer)
           
 double item(int n)
          Returns n-th component of the vector.
static boolean less(csDVector3 v, double f)
          Test if each component of a vector is less than a small epsilon value.
 csDVector3 minus()
          Unary - operator.
 csDVector3 minus(csDVector3 v)
          Subtract another vector from this vector.
static csDVector3 minus(csDVector3 v1, csDVector3 v2)
          Subtract two vectors.
static csDVector3 mod(csDVector3 v1, csDVector3 v2)
          Take the cross product of two vectors.
static double mul(csDVector3 v1, csDVector3 v2)
          Take the dot product of two vectors.
static csDVector3 mul(csDVector3 v, double f)
          Multiply a vector and a scalar.
 csDVector3 mul(double f)
          Multiply this vector by a scalar.
static csDVector3 mul(double f, csDVector3 v)
          Multiply a vector and a scalar.
protected  void nDelete(long pointer)
           
static boolean nEquals(csDVector3 v1, csDVector3 v2)
          Check if two vectors are not equal.
 double norm()
          Returns the norm of this vector.
static double norm(csDVector3 v)
          Returns the norm (magnitude) of a vector.
 void normalize()
          Scale this vector to length = 1.0.
static csDVector3 projectl(csDVector3 v1, csDVector3 v2)
          Project one vector onto another.
static csDVector3 projectr(csDVector3 v1, csDVector3 v2)
          Project one vector onto another.
 void set(double sx, double sy, double sz)
          Set the value of this vector.
 double squaredNorm()
          Returns the norm of this vector.
 csDVector3 unit()
          Returns the unit vector in the direction of this vector.
static csDVector3 unit(csDVector3 v)
          Normalizes a vector to a unit vector.
 double x()
          The X component of the vector.
 void x(double x)
          The X component of the vector.
 double y()
          The Y component of the vector.
 void y(double y)
          The Y component of the vector.
 double z()
          The Z component of the vector.
 void z(double z)
          The Z component of the vector.
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, finalize, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

csDVector3

public csDVector3(iPointer nPointer)
Create a java csDVector3 object which points to the native csDVector3 nPointer.

Parameters:
nPointer -

csDVector3

public csDVector3()
Make a new vector.


csDVector3

public csDVector3(double m)
Make a new initialized vector.

Parameters:
m -

csDVector3

public csDVector3(double ix,
                  double iy)
Make a new vector and initialize with the given values.

Parameters:
ix -
iy -

csDVector3

public csDVector3(double ix,
                  double iy,
                  double iz)
Make a new vector and initialize with the given values.

Parameters:
ix -
iy -
iz -

csDVector3

public csDVector3(csDVector3 v)
Copy Constructor.

Parameters:
v -

csDVector3

public csDVector3(csVector3 v)
Conversion from single precision vector to double.

Parameters:
v -
Method Detail

nDelete

protected void nDelete(long pointer)
Specified by:
nDelete in class csNativeObject
See Also:
csNativeObject.nDelete(long)

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long nPointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
crystalspace.jbind.impl.csNativeObject#isNativePointerValidSafe()

cross

public final void cross(csDVector3 px,
                        csDVector3 py)
Take cross product of two vectors and put result in this vector.

Parameters:
px -
py -

item

public final double item(int n)
Returns n-th component of the vector.

Parameters:
n -
Returns:

add

public final csDVector3 add(csDVector3 v)
Add another vector to this vector.

Parameters:
v -
Returns:

minus

public final csDVector3 minus(csDVector3 v)
Subtract another vector from this vector.

Parameters:
v -
Returns:

mul

public final csDVector3 mul(double f)
Multiply this vector by a scalar.

Parameters:
f -
Returns:

div

public final csDVector3 div(double f)
Divide this vector by a scalar.

Parameters:
f -
Returns:

add

public final csDVector3 add()
Unary + operator.

Returns:

minus

public csDVector3 minus()
Unary - operator.

Returns:

set

public final void set(double sx,
                      double sy,
                      double sz)
Set the value of this vector.

Parameters:
sx -
sy -
sz -

norm

public final double norm()
Returns the norm of this vector.

Returns:

squaredNorm

public final double squaredNorm()
Returns the norm of this vector.

Returns:

unit

public final csDVector3 unit()
Returns the unit vector in the direction of this vector.

Returns:

normalize

public final void normalize()
Scale this vector to length = 1.0.


norm

public static final double norm(csDVector3 v)
Returns the norm (magnitude) of a vector.

Parameters:
v -
Returns:

unit

public static final csDVector3 unit(csDVector3 v)
Normalizes a vector to a unit vector.

Parameters:
v -
Returns:

x

public final double x()
The X component of the vector.

Returns:

x

public final void x(double x)
The X component of the vector.

Parameters:
x -

y

public final double y()
The Y component of the vector.

Returns:

y

public final void y(double y)
The Y component of the vector.

Parameters:
y -

z

public final double z()
The Z component of the vector.

Returns:

z

public final void z(double z)
The Z component of the vector.

Parameters:
z -

add

public static final csDVector3 add(csDVector3 v1,
                                   csDVector3 v2)
Add two vectors.

Parameters:
v1 -
v2 -
Returns:

minus

public static final csDVector3 minus(csDVector3 v1,
                                     csDVector3 v2)
Subtract two vectors.

Parameters:
v1 -
v2 -
Returns:

mul

public static final double mul(csDVector3 v1,
                               csDVector3 v2)
Take the dot product of two vectors.

Parameters:
v1 -
v2 -
Returns:

mod

public static final csDVector3 mod(csDVector3 v1,
                                   csDVector3 v2)
Take the cross product of two vectors.

Parameters:
v1 -
v2 -
Returns:

mul

public static final csDVector3 mul(csDVector3 v,
                                   double f)
Multiply a vector and a scalar.

Parameters:
v -
f -
Returns:

mul

public static final csDVector3 mul(double f,
                                   csDVector3 v)
Multiply a vector and a scalar.

Parameters:
f -
v -
Returns:

div

public static final csDVector3 div(csDVector3 v,
                                   double f)
Divide a vector by a scalar.

Parameters:
v -
f -
Returns:

equals

public static final boolean equals(csDVector3 v1,
                                   csDVector3 v2)
Check if two vectors are equal.

Parameters:
v1 -
v2 -
Returns:

nEquals

public static final boolean nEquals(csDVector3 v1,
                                    csDVector3 v2)
Check if two vectors are not equal.

Parameters:
v1 -
v2 -
Returns:

projectr

public static final csDVector3 projectr(csDVector3 v1,
                                        csDVector3 v2)
Project one vector onto another.

Parameters:
v1 -
v2 -
Returns:

projectl

public static final csDVector3 projectl(csDVector3 v1,
                                        csDVector3 v2)
Project one vector onto another.

Parameters:
v1 -
v2 -
Returns:

less

public static final boolean less(csDVector3 v,
                                 double f)
Test if each component of a vector is less than a small epsilon value.

Parameters:
v -
f -
Returns:

greater

public static boolean greater(double f,
                              csDVector3 v)
Test if each component of a vector is greater than a small epsilon value.

Parameters:
f -
v -
Returns:

equals

public final boolean equals(java.lang.Object obj)
Check if two vectors are equal.

Overrides:
equals in class csNativeObject
See Also:
Object.equals(java.lang.Object)