frams_client_3d
Class VectorMath

java.lang.Object
  extended byframs_client_3d.VectorMath

public class VectorMath
extends java.lang.Object

Class of functions for vectors manipulation.

Author:
MoMaT

Constructor Summary
VectorMath()
           
 
Method Summary
 float length(float[] vector)
          Calculates the length of a vector.
 float[] normalize(float[] vector)
          Normalize a vector.
 float[] rotate(float angle, float[] axis, float[] vector)
          Rotates a vector around an axis about an angle.
 float scalarProduct(float[] v1, float[] v2)
          Calculates the dot product of two vectors.
 float[] vector(float[] p1, float[] p2)
          Calculates coordiantes of a vector between two points.
 float[] vectorProduct(float[] v1, float[] v2)
          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
 

Constructor Detail

VectorMath

public VectorMath()
Method Detail

vector

public float[] vector(float[] p1,
                      float[] p2)
Calculates coordiantes of a vector between two points.

Parameters:
p1 -
p2 -
Returns:
vector

rotate

public float[] rotate(float angle,
                      float[] axis,
                      float[] vector)
Rotates a vector around an axis about an angle.

Parameters:
angle -
axis -
vector -
Returns:
rotation vector

vectorProduct

public float[] vectorProduct(float[] v1,
                             float[] v2)
Calculates the cross product of two vectors.

Parameters:
v1 - first vector
v2 - second vector
Returns:
plane normal vector

normalize

public float[] normalize(float[] vector)
Normalize a vector.

Parameters:
vector -
Returns:
normalized vector

length

public float length(float[] vector)
Calculates the length of a vector.

Parameters:
vector -
Returns:
vector length

scalarProduct

public float scalarProduct(float[] v1,
                           float[] v2)
Calculates the dot product of two vectors.

Parameters:
v1 - first vector
v2 - second vector
Returns:
scalar quantity