crystalspace.jbind.impl.csgeom.vector4
Class csDVector4

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csgeom.vector4.csDVector4
All Implemented Interfaces:
iPointer

public class csDVector4
extends csNativeObject

A 4D vector.

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/pubapi/classcsDVector4.php

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csDVector4()
          Make a new vector.
csDVector4(csDVector3 v)
          Conversion from a 3 component vector. set W =0;.
csDVector4(csDVector4 v)
          Copy Constructor.
csDVector4(csVector4 v)
          Conversion from single precision vector to double.
csDVector4(double m)
          Make a new initialized vector.
csDVector4(double ix, double iy)
          Make a new vector and initialize with the given values.
csDVector4(double ix, double iy, double iz)
          Make a new vector and initialize with the given values.
csDVector4(double ix, double iy, double iz, double iw)
          Make a new vector and initialize with the given values.
csDVector4(iPointer nPointer)
           
 
Method Summary
 csDVector4 add()
          Unary + operator.
 csDVector4 add(csDVector4 v)
          Add another vector to this vector.
static csDVector4 add(csDVector4 v1, csDVector4 v2)
          Add two vectors.
 void cross(csDVector4 v1, csDVector4 v2)
          Take cross product of two vectors and put result in this vector.
static csDVector4 div(csDVector4 v, double f)
          Divide a vector by a scalar.
 csDVector4 div(double f)
          Divide this vector by a scalar.
static boolean equals(csDVector4 v1, csDVector4 v2)
          Check if two vectors are equal.
 boolean equals(java.lang.Object obj)
          Check if two vectors are equal.
static boolean greater(double f, csDVector4 v)
          Test if each component of a vector is greater than a small epsilon value.
protected  boolean isNativePointerValidSafe(long pointer)
           
 double item(int n)
          Returns n-th component of the vector.
 void item(int n, double f)
          Set n-th component of the vector.
static boolean less(csDVector4 v, double f)
          Test if each component of a vector is less than a small epsilon value.
 csDVector4 minus()
          Unary - operator.
 csDVector4 minus(csDVector4 v)
          Subtract another vector from this vector.
static csDVector4 minus(csDVector4 v1, csDVector4 v2)
          Subtract two vectors.
static csDVector4 mod(csDVector4 v1, csDVector4 v2)
          Take the cross product of two vectors.
static double mul(csDVector4 v1, csDVector4 v2)
          Take the dot product of two vectors.
static csDVector4 mul(csDVector4 v, double f)
          Multiply a vector and a scalar.
 csDVector4 mul(double f)
          Multiply this vector by a scalar.
static csDVector4 mul(double f, csDVector4 v)
          Multiply a vector and a scalar.
protected  void nDelete(long pointer)
           
static boolean nEquals(csDVector4 v1, csDVector4 v2)
          Check if two vectors are not equal.
 double norm()
          Returns the norm of this vector.
static double norm(csDVector4 v)
          Returns the norm (magnitude) of a vector.
 void normalize()
          Scale this vector to length = 1.0.
static csDVector4 projectl(csDVector4 v1, csDVector4 v2)
          Project one vector onto another.
static csDVector4 projectr(csDVector4 v1, csDVector4 v2)
          Project one vector onto another.
 void set(double sx, double sy, double sz, double sw)
          Set the value of this vector.
 double squaredNorm()
          Returns the norm of this vector.
 csDVector4 unit()
          Returns the unit vector in the direction of this vector.
static csDVector4 unit(csDVector4 v)
          Normalizes a vector to a unit vector.
 double w()
          The W component of the vector.
 void w(double W)
          The W component of the 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

csDVector4

public csDVector4(iPointer nPointer)
Parameters:
nPointer -

csDVector4

public csDVector4()
Make a new vector. The vector is not initialized. This makes the code slightly faster as csDVector4 objects are used a lot. Definition at line 60 of file vector4.h. Referenced by operator-().


csDVector4

public csDVector4(double m)
Make a new initialized vector. Creates a new vector and initializes it to m* <1,1,1,1>. To create a vector initialized to the zero vector, use csDVector4(0) Definition at line 67 of file vector4.h. References w, x, y, and z.

Parameters:
m -

csDVector4

public csDVector4(double ix,
                  double iy)
Make a new vector and initialize with the given values. Definition at line 70 of file vector4.h. References w, x, y, and z.

Parameters:
ix -
iy -

csDVector4

public csDVector4(double ix,
                  double iy,
                  double iz)
Make a new vector and initialize with the given values. Definition at line 70 of file vector4.h. References w, x, y, and z.

Parameters:
ix -
iy -
iz -

csDVector4

public csDVector4(double ix,
                  double iy,
                  double iz,
                  double iw)
Make a new vector and initialize with the given values. Definition at line 70 of file vector4.h. References w, x, y, and z.

Parameters:
ix -
iy -
iz -
iw -

csDVector4

public csDVector4(csDVector4 v)
Copy Constructor. Definition at line 73 of file vector4.h. References w, x, y, and z.

Parameters:
v -

csDVector4

public csDVector4(csVector4 v)
Conversion from single precision vector to double.

Parameters:
v -

csDVector4

public csDVector4(csDVector3 v)
Conversion from a 3 component vector. set W =0;. Definition at line 79 of file vector4.h. References w, csDVector3::x, x, csDVector3::y, y, csDVector3::z, and z.

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 pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
csNativeObject.isNativePointerValidSafe(long)

cross

public void cross(csDVector4 v1,
                  csDVector4 v2)
Take cross product of two vectors and put result in this vector. Definition at line 106 of file vector4.h. References w, x, y, and z.

Parameters:
v1 -
v2 -

norm

public static double norm(csDVector4 v)
Returns the norm (magnitude) of a vector. Definition at line 211 of file vector4.h. References Norm().

Parameters:
v -
Returns:

norm

public double norm()
Returns the norm of this vector. Referenced by Norm(), and Unit().

Returns:

normalize

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


mul

public csDVector4 mul(double f)
Multiply this vector by a scalar. Definition at line 181 of file vector4.h. References w, x, y, and z.


add

public csDVector4 add()
Unary + operator. Definition at line 189 of file vector4.h.

Returns:

add

public csDVector4 add(csDVector4 v)
Add another vector to this vector. Definition at line 159 of file vector4.h. References w, x, y, and z.

Parameters:
v -
Returns:

minus

public csDVector4 minus()
Unary - operator. Definition at line 192 of file vector4.h. References csDVector4(), w, x, y, and z.

Returns:

minus

public csDVector4 minus(csDVector4 v)
Subtract another vector from this vector. Definition at line 170 of file vector4.h. References w, x, y, and z.

Parameters:
v -
Returns:

div

public csDVector4 div(double f)
Divide this vector by a scalar. Definition at line 185 of file vector4.h. References w, x, y, and z.

Parameters:
f -
Returns:

item

public double item(int n)
Returns n-th component of the vector. Definition at line 156 of file vector4.h. References w, x, y, and z.

Parameters:
n -
Returns:

item

public void item(int n,
                 double f)
Set n-th component of the vector. Definition at line 156 of file vector4.h. References w, x, y, and z.

Parameters:
n -
Returns:

set

public void set(double sx,
                double sy,
                double sz,
                double sw)
Set the value of this vector. Definition at line 195 of file vector4.h. References w, x, y, and z.

Parameters:
sx -
sy -
sz -
sw -

squaredNorm

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

Returns:

unit

public static csDVector4 unit(csDVector4 v)
Normalizes a vector to a unit vector. Definition at line 214 of file vector4.h. References Unit().

Parameters:
v -
Returns:

unit

public csDVector4 unit()
Returns the unit vector in the direction of this vector. Attempting to normalize a zero-vector will result in a divide by zero error. This is as it should be... fix the calling code. Definition at line 208 of file vector4.h. References Norm(). Referenced by Unit().

Returns:

mul

public static csDVector4 mul(double f,
                             csDVector4 v)
Multiply a vector and a scalar. Definition at line 119 of file vector4.h.

Parameters:
f -
v -
Returns:

mul

public static csDVector4 mul(csDVector4 v,
                             double f)
Multiply a vector and a scalar. Definition at line 115 of file vector4.h.

Parameters:
v -
f -
Returns:

mul

public static double mul(csDVector4 v1,
                         csDVector4 v2)
Take the dot product of two vectors. Definition at line 92 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

nEquals

public static boolean nEquals(csDVector4 v1,
                              csDVector4 v2)
Check if two vectors are not equal. Definition at line 131 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

mod

public static csDVector4 mod(csDVector4 v1,
                             csDVector4 v2)
Take the cross product of two vectors. Definition at line 96 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

add

public static csDVector4 add(csDVector4 v1,
                             csDVector4 v2)
Add two vectors. Definition at line 83 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

minus

public static csDVector4 minus(csDVector4 v1,
                               csDVector4 v2)
Subtract two vectors. Definition at line 88 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

div

public static csDVector4 div(csDVector4 v,
                             double f)
Divide a vector by a scalar. Definition at line 123 of file vector4.h.

Parameters:
v -
f -
Returns:

less

public static boolean less(csDVector4 v,
                           double f)
Test if each component of a vector is less than a small epsilon value. Definition at line 145 of file vector4.h.

Parameters:
v -
f -
Returns:

projectl

public static csDVector4 projectl(csDVector4 v1,
                                  csDVector4 v2)
Project one vector onto another. Definition at line 141 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

equals

public static boolean equals(csDVector4 v1,
                             csDVector4 v2)
Check if two vectors are equal. Definition at line 127 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

greater

public static boolean greater(double f,
                              csDVector4 v)
Test if each component of a vector is greater than a small epsilon value. Definition at line 149 of file vector4.h.

Parameters:
f -
v -
Returns:

projectr

public static csDVector4 projectr(csDVector4 v1,
                                  csDVector4 v2)
Project one vector onto another. Definition at line 136 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

w

public double w()
The W component of the vector. Definition at line 53 of file vector4.h. Referenced by Cross(), csDVector4(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), and Set().

Returns:

w

public void w(double W)
The W component of the vector. Definition at line 53 of file vector4.h. Referenced by Cross(), csDVector4(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), and Set().

Parameters:
W -

x

public double x()
The X component of the vector. Definition at line 47 of file vector4.h. Referenced by Cross(), csDVector4(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), and Set().

Returns:

x

public void x(double X)
The X component of the vector. Definition at line 47 of file vector4.h. Referenced by Cross(), csDVector4(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), and Set().


y

public double y()
The Y component of the vector. Definition at line 49 of file vector4.h. Referenced by Cross(), csDVector4(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), and Set().

Returns:

y

public void y(double Y)
The Y component of the vector. Definition at line 49 of file vector4.h. Referenced by Cross(), csDVector4(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), and Set().

Parameters:
Y -

z

public double z()
The Z component of the vector. Definition at line 51 of file vector4.h. Referenced by Cross(), csDVector4(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), and Set().

Returns:

z

public void z(double Z)
The Z component of the vector. Definition at line 51 of file vector4.h. Referenced by Cross(), csDVector4(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), and Set().

Parameters:
Z -

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)