com.tensegrity.generic.math
Class Vector4

java.lang.Object
  extended bycom.tensegrity.generic.math.Vector4

public final class Vector4
extends java.lang.Object

This class represents a vector in 4d space.

Version:
$Id: Vector4.java,v 1.9 2006/01/26 17:05:22 MichaelKegel Exp $
Author:
MichaelKegel, S. Rutz

Field Summary
 double w
          w component
 double x
          x component
 double y
          y component
 double z
          z component
 
Constructor Summary
Vector4()
          Constructor for Vector4.
Vector4(double x, double y, double z, double w)
          Constructor for Vector4.
Vector4(Vector4 vector)
          Copy Constructor for Vector4.
 
Method Summary
 void add(double x, double y, double z, double w)
          Adds the specified values to this vector.
 double dot(Vector4 vector)
          Computes the vector dot-product of this vector times the specified vector.
 double length()
          Computes the length (magnitude) of this vector.
 void normalize()
          Normalize this vector to unit-length 1 if its magnitude is not equal 0.
 void scale(double scale)
          Scales this vector by the given factor.
 void set(double x, double y, double z, double w)
          Sets this vector to the specified values.
 void sub(double x, double y, double z, double w)
          Subtracts the specified values from this vector.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x
x component


y

public double y
y component


z

public double z
z component


w

public double w
w component

Constructor Detail

Vector4

public Vector4()
Constructor for Vector4. This creates a new instance with all values set to 0.0.


Vector4

public Vector4(Vector4 vector)
Copy Constructor for Vector4.

Parameters:
vector - vector to copy values from. This argument must not be null.

Vector4

public Vector4(double x,
               double y,
               double z,
               double w)
Constructor for Vector4.

Parameters:
x - value for x component.
y - value for y component.
z - value for z component.
w - value for w component.
Method Detail

set

public final void set(double x,
                      double y,
                      double z,
                      double w)
Sets this vector to the specified values.

Parameters:
x - new value for x component.
y - new value for y component.
z - new value for z component.
w - new value for w component.

add

public final void add(double x,
                      double y,
                      double z,
                      double w)
Adds the specified values to this vector.

Parameters:
x - value for x component.
y - value for y component.
z - value for z component.
w - value for w component.

sub

public final void sub(double x,
                      double y,
                      double z,
                      double w)
Subtracts the specified values from this vector.

Parameters:
x - value for x component.
y - value for y component.
z - value for z component.
w - value for w component.

scale

public final void scale(double scale)
Scales this vector by the given factor.

Parameters:
scale - factor to scale this vector with

length

public final double length()
Computes the length (magnitude) of this vector.

Returns:
the length (magnitude) of this vector.

normalize

public final void normalize()
Normalize this vector to unit-length 1 if its magnitude is not equal 0.


dot

public final double dot(Vector4 vector)
Computes the vector dot-product of this vector times the specified vector.

Parameters:
vector - other vector for dot product.
Returns:
the dot product.

toString

public java.lang.String toString()
Returns a string representation of this object.

Returns:
a string representation of this object.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.