CubeTwister 2.0alpha141 2011-10-13

idx3d
Class idx3d_Vector

java.lang.Object
  extended by idx3d.idx3d_Vector
All Implemented Interfaces:
java.lang.Cloneable

public class idx3d_Vector
extends java.lang.Object
implements java.lang.Cloneable

defines a 3d vector.


Field Summary
 float r
           
 float theta
           
 float x
           
 float y
           
 float z
           
 
Constructor Summary
idx3d_Vector()
           
idx3d_Vector(float xpos, float ypos, float zpos)
           
 
Method Summary
static idx3d_Vector add(idx3d_Vector a, idx3d_Vector b)
          adds 2 vectors.
static float angle(idx3d_Vector a, idx3d_Vector b)
          returns the angle between 2 vectors.
 void buildCartesian()
          Builds the cartesian coordinates out of the given cylindric coordinates.
 void buildCylindric()
          Builds the cylindric coordinates out of the given cartesian coordinates.
 idx3d_Vector clone()
           
static float dotProduct(idx3d_Vector a, idx3d_Vector b)
          dotProduct product of 2 vectors.
 boolean equals(idx3d_Vector that)
           
 boolean equals(java.lang.Object o)
           
 idx3d_Vector getClone()
           
static idx3d_Vector getNormal(idx3d_Vector a, idx3d_Vector b)
          returns the normal vector of the plane defined by the two vectors.
static idx3d_Vector getNormal(idx3d_Vector a, idx3d_Vector b, idx3d_Vector c)
          returns the normal vector of the plane defined by the two vectors.
static idx3d_Vector getNormalInto(idx3d_Vector a, idx3d_Vector b, idx3d_Vector c, idx3d_Vector resultVector)
          returns the normal vector of the plane defined by the two vectors.
 int hashCode()
           
static float len(idx3d_Vector a)
          length of vector.
 float length()
          Length of this vector.
 idx3d_Vector normalize()
          Normalizes the vector.
static float[] planeEquation(idx3d_Vector v1, idx3d_Vector v2, idx3d_Vector v3)
          Computes the plane equation a*x + b*y + c*z + d = 0 from three given points in space.
static idx3d_Vector random(float fact)
          returns a random vector.
 idx3d_Vector reverse()
          Reverses the vector.
static idx3d_Vector scale(float f, idx3d_Vector a)
          substracts 2 vectors.
 void setTo(float xpos, float ypos, float zpos)
           
static idx3d_Vector sub(idx3d_Vector a, idx3d_Vector b)
          subtracts 2 vectors.
 java.lang.String toString()
           
 idx3d_Vector transform(idx3d_Matrix m)
          Modifies the vector by matrix m.
 idx3d_Vector transformInto(idx3d_Matrix m, idx3d_Vector resultVector)
          Modifies the vector by matrix m.
static idx3d_Vector vectorProduct(idx3d_Vector a, idx3d_Vector b)
          returns a x b.
static idx3d_Vector vectorProduct(idx3d_Vector a, idx3d_Vector b, idx3d_Vector c)
          returns (b-a) x (c-a).
static idx3d_Vector vectorProductInto(idx3d_Vector a, idx3d_Vector b, idx3d_Vector resultVector)
          returns a x b.
static idx3d_Vector vectorProductInto(idx3d_Vector a, idx3d_Vector b, idx3d_Vector c, idx3d_Vector resultVector)
          returns (b-a) x (c-a).
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public float x

y

public float y

z

public float z

r

public float r

theta

public float theta
Constructor Detail

idx3d_Vector

public idx3d_Vector()

idx3d_Vector

public idx3d_Vector(float xpos,
                    float ypos,
                    float zpos)
Method Detail

setTo

public void setTo(float xpos,
                  float ypos,
                  float zpos)

normalize

public idx3d_Vector normalize()
Normalizes the vector.


reverse

public idx3d_Vector reverse()
Reverses the vector.


length

public float length()
Length of this vector.


transform

public idx3d_Vector transform(idx3d_Matrix m)
Modifies the vector by matrix m.


transformInto

public idx3d_Vector transformInto(idx3d_Matrix m,
                                  idx3d_Vector resultVector)
Modifies the vector by matrix m.


buildCylindric

public void buildCylindric()
Builds the cylindric coordinates out of the given cartesian coordinates.


buildCartesian

public void buildCartesian()
Builds the cartesian coordinates out of the given cylindric coordinates.


getNormal

public static idx3d_Vector getNormal(idx3d_Vector a,
                                     idx3d_Vector b)
returns the normal vector of the plane defined by the two vectors.


getNormal

public static idx3d_Vector getNormal(idx3d_Vector a,
                                     idx3d_Vector b,
                                     idx3d_Vector c)
returns the normal vector of the plane defined by the two vectors.


getNormalInto

public static idx3d_Vector getNormalInto(idx3d_Vector a,
                                         idx3d_Vector b,
                                         idx3d_Vector c,
                                         idx3d_Vector resultVector)
returns the normal vector of the plane defined by the two vectors.


vectorProduct

public static idx3d_Vector vectorProduct(idx3d_Vector a,
                                         idx3d_Vector b)
returns a x b.


vectorProductInto

public static idx3d_Vector vectorProductInto(idx3d_Vector a,
                                             idx3d_Vector b,
                                             idx3d_Vector resultVector)
returns a x b.


vectorProduct

public static idx3d_Vector vectorProduct(idx3d_Vector a,
                                         idx3d_Vector b,
                                         idx3d_Vector c)
returns (b-a) x (c-a).


vectorProductInto

public static idx3d_Vector vectorProductInto(idx3d_Vector a,
                                             idx3d_Vector b,
                                             idx3d_Vector c,
                                             idx3d_Vector resultVector)
returns (b-a) x (c-a).


angle

public static float angle(idx3d_Vector a,
                          idx3d_Vector b)
returns the angle between 2 vectors.


add

public static idx3d_Vector add(idx3d_Vector a,
                               idx3d_Vector b)
adds 2 vectors.


sub

public static idx3d_Vector sub(idx3d_Vector a,
                               idx3d_Vector b)
subtracts 2 vectors.


dotProduct

public static float dotProduct(idx3d_Vector a,
                               idx3d_Vector b)
dotProduct product of 2 vectors.


scale

public static idx3d_Vector scale(float f,
                                 idx3d_Vector a)
substracts 2 vectors.


len

public static float len(idx3d_Vector a)
length of vector.


random

public static idx3d_Vector random(float fact)
returns a random vector.


planeEquation

public static float[] planeEquation(idx3d_Vector v1,
                                    idx3d_Vector v2,
                                    idx3d_Vector v3)
Computes the plane equation a*x + b*y + c*z + d = 0 from three given points in space.

Parameters:
v1 -
v2 -
v3 -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getClone

public idx3d_Vector getClone()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(idx3d_Vector that)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

clone

public idx3d_Vector clone()
Overrides:
clone in class java.lang.Object

(c) Werner Randelshofer.
All rights reserved.