frams_client_3d
Class Vector3D

java.lang.Object
  extended byframs_client_3d.Vector3D

public class Vector3D
extends java.lang.Object

Three dimensional vectors class.

Author:
MoMaT

Field Summary
private  float[] v
           
 
Constructor Summary
Vector3D(float[] vector)
          Defualt parametrized constructor.
Vector3D(float vx, float vy, float vz)
          Default parametrized constructor.
Vector3D(Vector3D vector)
          Copy constructor.
 
Method Summary
 float[] getVector()
          Vector3D getter.
 float length()
          Calculates the length of the vector.
 void mult(float scalar)
          Multiply the vector by a scalar.
 void normalize()
          Normalize a vector.
 void rotate(float angle, Vector3D axis)
          Rotates the vector around an axis about an angle.
 float scalarProduct(Vector3D vector)
          Calculates the dot product with given vector.
 void vectorProduct(Vector3D vector)
          Calculates the cross product of two vectors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

v

private float[] v
Constructor Detail

Vector3D

public Vector3D(float vx,
                float vy,
                float vz)
Default parametrized constructor.

Parameters:
vx - vector x coordinate
vy - vector y coordinate
vz - vector z coordinate

Vector3D

public Vector3D(float[] vector)
Defualt parametrized constructor.

Parameters:
vector - an array of vector coordinates

Vector3D

public Vector3D(Vector3D vector)
Copy constructor.

Parameters:
vector - 3D vector object
Method Detail

getVector

public float[] getVector()
Vector3D getter.

Returns:
an array of vector coordinates

rotate

public void rotate(float angle,
                   Vector3D axis)
Rotates the vector around an axis about an angle.

Parameters:
angle - a rotation angle
axis - a rotation axis vector

vectorProduct

public void vectorProduct(Vector3D vector)
Calculates the cross product of two vectors.

Parameters:
vector -
Returns:
plane normal vector

normalize

public void normalize()
Normalize a vector.

Returns:
normalized vector

length

public float length()
Calculates the length of the vector.

Returns:
vector length

scalarProduct

public float scalarProduct(Vector3D vector)
Calculates the dot product with given vector.

Parameters:
vector -
Returns:
scalar quantity

mult

public void mult(float scalar)
Multiply the vector by a scalar.

Parameters:
scalar -