Class matrix3D.Vector3D
All Packages  Class Hierarchy  This Package  Previous  Next  Index
source

Class matrix3D.Vector3D

java.lang.Object
   |
   +----matrix3D.Vector3D

public class Vector3D
extends Object
A 4x1 (x, y, z, w) vector for doing 3D transforms.

Variable Index

 o name
The name of the vector.
 o w
The vector's w element.
 o x
The vector's x element.
 o y
The vector's y element.
 o z
The vector's z element.

Constructor Index

 o Vector3D()
Construct a vector initialized to (0, 0, 0, 1).
 o Vector3D(double, double, double)
Construct a vector initialized to the specified values.
 o Vector3D(String, double, double, double)
Construct a named vector initialized to the specified values.
 o Vector3D(String, double, double, double, double)
Construct a named vector initialized to the specified values.
 o Vector3D(Vector3D)
Construct a vector initialized to the input vector.
 o Vector3D(Vector3D, String)
Construct a vector initialized to the input vector and string.

Method Index

 o clean()
Return a "cleaned up" version of the vector.
 o clean(double)
Return a "cleaned up" version of the specified double value.
 o clean(String)
Return a "cleaned up" and named version of the vector.
 o cross(Vector3D)
Return the vector cross product of this and another vector.
 o dot(Vector3D)
Return the dot product of this and another vector.
 o equals(Vector3D)
Determine if the contents of two vectors are equal.
 o getMax()
Return the largest element of this vector.
 o getPoint(int)
Return the point which corresponds to the vector.
 o inverse()
Return the inverse of this vector.
 o length()
Return the length of this vector.
 o minus(Vector3D)
Return the difference between this and another vector.
 o negate()
Return a vector consisting of negated values.
 o normalize()
Return a normalized version of the vector.
 o plus(Vector3D)
Return the sum of this and another vector.
 o round(double)
Return a rounded off vector.
 o roundDouble(double, double)
 o scale(double)
Return the product of this vector and the specified scale factor.
 o setEqual(Vector3D)
Set the contents of this vector equal to the contents of the input vector.
 o toString()
Return a string representation of the vector.
 o toVertex()
Return a string representation of the vector as a 3D vertex.
 o toVertex2D()
Return a string representation of the vector as a 2D vertex.
 o total()
Return the total of the x, y and z elements.

Variables

 o x
  public double x
The vector's x element.
 o y
  public double y
The vector's y element.
 o z
  public double z
The vector's z element.
 o w
  public double w
The vector's w element.
 o name
  public String name
The name of the vector.

Constructors

 o Vector3D
  public Vector3D()
Construct a vector initialized to (0, 0, 0, 1).
 o Vector3D
  public Vector3D(double xIn,
                  double yIn,
                  double zIn)
Construct a vector initialized to the specified values. Construct a vector initialized to (xIn, yIn, zIn, 1).
 o Vector3D
  public Vector3D(String s,
                  double xIn,
                  double yIn,
                  double zIn)
Construct a named vector initialized to the specified values. Construct a named vector initialized to (xIn, yIn, zIn, 1).
 o Vector3D
  public Vector3D(String s,
                  double xIn,
                  double yIn,
                  double zIn,
                  double wIn)
Construct a named vector initialized to the specified values. Construct a named vector initialized to (xIn, yIn, zIn, wIn).
 o Vector3D
  public Vector3D(Vector3D v)
Construct a vector initialized to the input vector. Construct a vector initialized to (v.x, v.y, v.z, v.w) with a name equal to v.name.
 o Vector3D
  public Vector3D(Vector3D v,
                  String s)
Construct a vector initialized to the input vector and string. Construct a vector initialized to (v.x, v.y, v.z, v.w) with a name equal to s.

Methods

 o clean
  public Vector3D clean()
Return a "cleaned up" version of the vector. Set any value less than a minimum threshold to 0.
 o clean
  public static double clean(double d)
Return a "cleaned up" version of the specified double value.
 o clean
  public Vector3D clean(String s)
Return a "cleaned up" and named version of the vector.
 o cross
  public Vector3D cross(Vector3D vIn)
Return the vector cross product of this and another vector.
Returns:
[this] X [vIn]
 o dot
  public double dot(Vector3D vIn)
Return the dot product of this and another vector.
Returns:
[this] DOT [vIn]
 o equals
  public boolean equals(Vector3D v)
Determine if the contents of two vectors are equal.
Returns:
true if the vectors' contents are equal, false otherwise
 o getPoint
  public Point getPoint(int winHeight)
Return the point which corresponds to the vector. The y coordinate of the point must be flipped.
Returns:
Point (x, winHeight -y)
 o getMax
  public double getMax()
Return the largest element of this vector.
 o inverse
  public Vector3D inverse()
Return the inverse of this vector.
Returns:
[1/x, 1/y, 1/z, 1]
 o length
  public double length()
Return the length of this vector. Return the square root of x squared plus y squared plus z squared.
 o minus
  public Vector3D minus(Vector3D v)
Return the difference between this and another vector.
Returns:
[this] - [v]
 o negate
  public Vector3D negate()
Return a vector consisting of negated values.
Returns:
[-x, -y, -z, 1]
 o normalize
  public Vector3D normalize()
Return a normalized version of the vector. Return an (x, y, z, 1) vector in which each element has been divided by the length of the vector.
 o plus
  public Vector3D plus(Vector3D v)
Return the sum of this and another vector.
Returns:
[this] + [v]
 o scale
  public Vector3D scale(double d)
Return the product of this vector and the specified scale factor.
Returns:
[this] * f
 o setEqual
  public void setEqual(Vector3D v)
Set the contents of this vector equal to the contents of the input vector.
 o round
  public Vector3D round(double d)
Return a rounded off vector. If d=10 then round off to tenths, d=100 then round off to hundredths, etc.
 o roundDouble
  public static double roundDouble(double n,
                                   double d)
 o toString
  public String toString()
Return a string representation of the vector.
Overrides:
toString in class Object
 o toVertex
  public String toVertex()
Return a string representation of the vector as a 3D vertex.
 o toVertex2D
  public String toVertex2D()
Return a string representation of the vector as a 2D vertex.
 o total
  public double total()
Return the total of the x, y and z elements.
Returns:
x + y + z

All Packages  Class Hierarchy  This Package  Previous  Next  Index