All Packages  This Package  Class Hierarchy  Class Search  Index

Class acg.stuttgart.rich.vector.Vector3D
java.lang.Object
   |
   +----acg.stuttgart.rich.vector.VectorND
           |
           +----acg.stuttgart.rich.vector.Vector3D

  Summary

public class  Vector3D
     extends acg.stuttgart.rich.vector.VectorND
{
          // Fields 1
     public float[] array;

          // Constructors 4
     public Vector3D();
     public Vector3D(Vector3D);
     public Vector3D(float, float, float);
     public Vector3D(float[]) throws VectorNDException;

          // Methods 18
     public static void rotateZ(float, Vector3D[]);
     public static void screenMap(Dimension, float, float, float, float, Vector2D[], int[][]) throws VectorNDException;
     public static void screenMap(Dimension, float, float, float, float, Vector3D[], int[][]) throws VectorNDException;
     public static void simpleProject(float, Vector3D[], Vector2D[]) throws VectorNDException;
     public static void translate(Vector3D, Vector3D[]);

     public Vector3D add(Vector3D);
     public void addIP(Vector3D);
     public Vector3D cross(Vector3D);
     public float inner(Vector3D);
     public float magnitude();
     public Vector3D multiply(float);
     public void multiplyIP(float);
     public float[][] outer(Vector3D);
     public void set(Vector3D);
     public void set(float, float, float);
     public Vector3D subtract(Vector3D);
     public void subtractIP(Vector3D);
     public float[] toArray();
}


  Cross Reference

Returned By:
CatmullRomSpline3D.HermiteTreeNode.evaluate(), CatmullRomSpline3D.evaluate(), CatmullRomSpline3D.sample(), CatmullRomSplineLoop3D.evaluate(), FastCRSplineLoop3D.evaluate(), Hermite3D.evaluate(), Spline3D.evaluate(), Vector3D.add(), Vector3D.cross(), Vector3D.multiply(), Vector3D.subtract()





  Fields

· array

Summary  |  Top
   public float[] array

An array of floats representing the vector.


  Constructors

· Vector3D

Summary  |  Top

   public Vector3D() 

The default constructor.



· Vector3D

Summary  |  Top
   public Vector3D(float x, 
                   float y, 
                   float z) 

Constructs a Vector3D from three floats.

Parameter Description
x The first coordinate.
y The second coordinate.
z The third coordinate.



· Vector3D

Summary  |  Top
   public Vector3D(float[] array)  throws VectorNDException

Constructs a Vector3D from an array of floats.

Parameter Description
array[] An array of three floats.



· Vector3D

Summary  |  Top
   public Vector3D(Vector3D obj) 

Copy constructor. This method returns a new Vector3D identical to its argument.

Parameter Description
obj The vector to be copied.



  Methods

· simpleProject

Summary  |  Top
   public static void simpleProject(float viewPlane, 
                                    Vector3D[] p, 
                                    Vector2D[] r)  throws VectorNDException

This is a very simple projection operation which assumes the camera is located at the origin and is pointing down the positive Y axis, with the up vector pointing in the direction of positive Z. The distance of the viewing plane from the eye point (origin) is specified by viewPlane. No clipping or rotation is done here. Note that this method operates in-place (no new storage is allocated) and that the length of p[] must match that of r[].

Parameter Description
viewPlane The distance of the viewing plane from the eye point.
p[] An array of 3D points to be projected.
r[] An array of 2D points resulting from the projection



· translate

Summary  |  Top
   public static void translate(Vector3D trans, 
                                Vector3D[] p) 

The translate method takes an array of vectors p[] and translates them by the vector trans. This method operates in-place, making it faster than a series of Vector3D::add calls.

Parameter Description
trans A translation vector.
p[] The array of vectors to be translated.



· rotateZ

Summary  |  Top
   public static void rotateZ(float radians, 
                              Vector3D[] p) 

The rotateZ method rotates the list of points p[] by radians around the Z axis. This method operates in-place.

Parameter Description
radians The angle of rotation in radians.
p[] The array of vectors to be rotated.



· screenMap

Summary  |  Top
   public static void screenMap(Dimension screen, 
                                float xmin, 
                                float ymin, 
                                float xrange, 
                                float yrange, 
                                Vector2D[] p, 
                                int[][] r)  throws VectorNDException

The screenMap method takes an array of 2D vectors (presumably returned by simpleProject) and maps them into screen coordinates. Note that this method operates in place, and that the length of p and r[] must be the same.

Parameter Description
screen the size of the screen.
xmin clipping window minimum x.
ymin clipping window minimum y.
xrange width of clipping window.
yrange height of clipping window.
p[] an array of N 2D vectors.
r[][] a two dimensional array of integers (dimension N X 2) which will hold the transformed points.



· screenMap

Summary  |  Top
   public static void screenMap(Dimension screen, 
                                float xmin, 
                                float ymin, 
                                float xrange, 
                                float yrange, 
                                Vector3D[] p, 
                                int[][] r)  throws VectorNDException

This version of screenMap takes an array of 3D vectors and maps them into screen coordinates by ignoring the the z coordinate, which is assumed to be one. Note that this method operates in place, and that the length of p and r[] must be the same.

Parameter Description
screen the size of the screen.
xmin clipping window minimum x.
ymin clipping window minimum y.
xrange width of clipping window.
yrange height of clipping window.
p[] an array of N 3D vectors.
r[][] a two dimensional array of integers (dimension N X 2) which will hold the transformed points.



· toArray

Summary  |  Top
   public float[] toArray() 

The toArray() method returns an array representation of a Vector3D.

Overrides:
toArray in class VectorND


· magnitude

Summary  |  Top
   public float magnitude() 

The magnitude method returns the magnitude of a Vector3D.



· set

Summary  |  Top
   public void set(float x, 
                   float y, 
                   float z) 

Set this vector to (x,y,z)

Parameter Description
x The first coordinate.
y The second coordinate.
z The third coordinate.



· set

Summary  |  Top
   public void set(Vector3D obj) 

Set this vector to this other vector

Parameter Description
obj The vector to be copied.



· add

Summary  |  Top
   public Vector3D add(Vector3D a) 

Addition method.

Parameter Description
a The second vector.

Returns:
The addition of two vectors.


· addIP

Summary  |  Top
   public void addIP(Vector3D a) 

In-place addition.

Parameter Description
a The second vector.



· subtract

Summary  |  Top
   public Vector3D subtract(Vector3D a) 

Subtraction method.

Parameter Description
a The second vector.

Returns:
this - a


· subtractIP

Summary  |  Top
   public void subtractIP(Vector3D a) 

In-place subtraction method.

Parameter Description
a The second vector.



· multiply

Summary  |  Top
   public Vector3D multiply(float s) 

Multiplication method.

Parameter Description
s A scaling factor.

Returns:
this * s


· multiplyIP

Summary  |  Top
   public void multiplyIP(float s) 

In-place multiplication method.

Parameter Description
s A scaling factor.



· inner

Summary  |  Top
   public float inner(Vector3D a) 

Inner product method. Computes inner (dot) product of two vectors.

Parameter Description
a The second vector.

Returns:
The (scalar) inner product.


· outer

Summary  |  Top
   public float[][] outer(Vector3D a) 

Outer product method. Computes the outer product of two vectors. Note: this results in a square matrix of dimension 3x3.

Parameter Description
X Needs to be documented

Returns:
The matrix resulting from the outer product of the two vectors in the form of a 3x3 array of floats.


· cross

Summary  |  Top
   public Vector3D cross(Vector3D a) 

This method calculates the cross product of two three-dimensional vectors.

Parameter Description
a The second vector.

Returns:
A Vector3D representing the cross product.


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7