crystalspace.jbind.impl.csgeom.vector4
Class csVector4

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

public class csVector4
extends csNativeObject

A 4D vector.

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

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

csVector4

public csVector4(iPointer nPointer)
Parameters:
nPointer -

csVector4

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


csVector4

public csVector4(float 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 csVector4(0) Definition at line 248 of file vector4.h. References w, x, y, and z.

Parameters:
m -

csVector4

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

Parameters:
ix -
iy -

csVector4

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

Parameters:
ix -
iy -
iz -

csVector4

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

Parameters:
ix -
iy -
iz -
iw -

csVector4

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

Parameters:
v -

csVector4

public csVector4(csDVector4 v)
Copy from a double-vector.

Parameters:
v -

csVector4

public csVector4(csVector3 v)
Convert from csVector3. Set w = 1. Definition at line 260 of file vector4.h. References w, x, y, 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(csVector4 v1,
                  csVector4 v2)
Take cross product of two vectors and put result in this vector. Definition at line 301 of file vector4.h. References w, x, y, and z.

Parameters:
v1 -
v2 -

isZero

public boolean isZero()
Query if the vector is zero. Definition at line 441 of file vector4.h. References w, x, y, and z.

Returns:

isZero

public boolean isZero(float precision)
Query if the vector is zero. Definition at line 441 of file vector4.h. References w, x, y, and z.

Parameters:
precision -
Returns:

norm

public static float norm(csVector4 v)
Returns the norm (magnitude) of a vector. Definition at line 432 of file vector4.h. References Norm().

Parameters:
v -
Returns:

norm

public float 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 csVector4 mul(float f)
Multiply this vector by a scalar. Definition at line 398 of file vector4.h. References w, x, y, and z.

Parameters:
f -
Returns:

add

public csVector4 add()
Unary + operator. Definition at line 406 of file vector4.h.

Returns:

add

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

Parameters:
v -
Returns:

minus

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

Returns:

minus

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

Parameters:
v -
Returns:

div

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

Parameters:
f -
Returns:

item

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

Parameters:
n -
Returns:

item

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

Parameters:
n -
f -

set

public void set(csVector4 v)
Set the value of this vector. Definition at line 415 of file vector4.h. References w, x, y, and z.

Parameters:
v -

set

public void set(float sx,
                float sy,
                float sz,
                float sw)
Set the value of this vector. Definition at line 412 of file vector4.h. References w, x, y, and z. Referenced by csShaderVariable::SetValue().

Parameters:
sx -
sy -
sz -
sw -

squaredNorm

public float squaredNorm()
Return the squared norm (magnitude) of this vector. Definition at line 421 of file vector4.h. References w, x, y, and z.

Returns:

unit

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

Parameters:
v -
Returns:

unit

public csVector4 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 429 of file vector4.h. References Norm(). Referenced by Unit().

Returns:

mul

public static csVector4 mul(int f,
                            csVector4 v)
Multiply a vector and a scalar int. Definition at line 330 of file vector4.h.

Parameters:
f -
Returns:

mul

public static csVector4 mul(csVector4 v,
                            int f)
Multiply a vector and a scalar int. Definition at line 326 of file vector4.h.

Parameters:
v -
f -
Returns:

mul

public static csDVector4 mul(double f,
                             csVector4 v)
Multiply a vector and a scalar double. Upgrade v to DVector. Definition at line 322 of file vector4.h.

Parameters:
f -
v -
Returns:

mul

public static csDVector4 mul(csVector4 v,
                             double f)
Multiply a vector and a scalar double. Upgrade v to DVector. Definition at line 318 of file vector4.h.

Parameters:
v -
f -
Returns:

mul

public static csVector4 mul(float f,
                            csVector4 v)
Multiply a vector and a scalar. Definition at line 314 of file vector4.h.

Parameters:
f -
v -
Returns:

mul

public static csVector4 mul(csVector4 v,
                            float f)
Multiply a vector and a scalar. Definition at line 310 of file vector4.h.

Parameters:
v -
f -
Returns:

mul

public static float mul(csVector4 v1,
                        csVector4 v2)
Take the dot product of two vectors. Definition at line 288 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

nEquals

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

Parameters:
v1 -
v2 -
Returns:

mod

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

Parameters:
v1 -
v2 -
Returns:

add

public static csDVector4 add(csVector4 v1,
                             csDVector4 v2)
Add two vectors of differing type, raise the csVector4 to DVector3. Definition at line 271 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

add

public static csDVector4 add(csDVector4 v1,
                             csVector4 v2)
Add two vectors of differing type, raise the csVector4 to DVector3. Definition at line 267 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

add

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

Parameters:
v1 -
v2 -
Returns:

minus

public static csDVector4 minus(csDVector4 v1,
                               csVector4 v2)
Subtract two vectors of differing type, cast to double. Definition at line 283 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

minus

public static csDVector4 minus(csVector4 v1,
                               csDVector4 v2)
Subtract two vectors of differing type, cast to double. Definition at line 279 of file vector4.h.

Parameters:
v1 -
v2 -
Returns:

minus

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

Parameters:
v1 -
v2 -
Returns:

div

public static csVector4 div(csVector4 v,
                            int f)
Divide a vector by a scalar int. Definition at line 342 of file vector4.h.

Parameters:
v -
f -
Returns:

div

public static csDVector4 div(csVector4 v,
                             double f)
Divide a vector by a scalar double. Upgrade v to DVector. Definition at line 338 of file vector4.h.

Parameters:
v -
f -
Returns:

div

public static csVector4 div(csVector4 v,
                            float f)
Divide a vector by a scalar. Definition at line 334 of file vector4.h.

Parameters:
v -
f -
Returns:

less

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

Parameters:
v -
f -
Returns:

projectl

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

Parameters:
v1 -
v2 -
Returns:

equals

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

Parameters:
v1 -
v2 -
Returns:

greater

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

Parameters:
f -
v -
Returns:

projectr

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

Parameters:
v1 -
v2 -
Returns:

w

public float w()
The W component of the vector. Definition at line 234 of file vector4.h. Referenced by Cross(), csVector4(), csShaderVariable::GetValue(), IsZero(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), Set(), csShaderVariable::SetValue(), and SquaredNorm().

Returns:

w

public void w(float W)
The W component of the vector. Definition at line 234 of file vector4.h. Referenced by Cross(), csVector4(), csShaderVariable::GetValue(), IsZero(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), Set(), csShaderVariable::SetValue(), and SquaredNorm().

Parameters:
W -

x

public float x()
The X component of the vector. Definition at line 228 of file vector4.h. Referenced by Cross(), csVector4(), csShaderVariable::GetValue(), IsZero(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), Set(), csShaderVariable::SetValue(), and SquaredNorm().

Returns:

x

public void x(float X)
The X component of the vector. Definition at line 228 of file vector4.h. Referenced by Cross(), csVector4(), csShaderVariable::GetValue(), IsZero(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), Set(), csShaderVariable::SetValue(), and SquaredNorm().

Parameters:
X -

y

public float y()
The Y component of the vector. Definition at line 230 of file vector4.h. Referenced by Cross(), csVector4(), csShaderVariable::GetValue(), IsZero(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), Set(), csShaderVariable::SetValue(), and SquaredNorm().

Returns:

y

public void y(float Y)
The Y component of the vector. Definition at line 230 of file vector4.h. Referenced by Cross(), csVector4(), csShaderVariable::GetValue(), IsZero(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), Set(), csShaderVariable::SetValue(), and SquaredNorm().

Parameters:
Y -

z

public float z()
The Z component of the vector. Definition at line 232 of file vector4.h. Referenced by Cross(), csVector4(), csShaderVariable::GetValue(), IsZero(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), Set(), csShaderVariable::SetValue(), and SquaredNorm().

Returns:

z

public void z(float Z)
The Z component of the vector. Definition at line 232 of file vector4.h. Referenced by Cross(), csVector4(), csShaderVariable::GetValue(), IsZero(), operator *=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), Set(), csShaderVariable::SetValue(), and SquaredNorm().

Parameters:
Z -