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.
-
name
- The name of the vector.
-
w
- The vector's w element.
-
x
- The vector's x element.
-
y
- The vector's y element.
-
z
- The vector's z element.
-
Vector3D()
- Construct a vector initialized to (0, 0, 0, 1).
-
Vector3D(double, double, double)
- Construct a vector initialized to the specified values.
-
Vector3D(String, double, double, double)
- Construct a named vector initialized to the specified values.
-
Vector3D(String, double, double, double, double)
- Construct a named vector initialized to the specified values.
-
Vector3D(Vector3D)
- Construct a vector initialized to the input vector.
-
Vector3D(Vector3D, String)
- Construct a vector initialized to the input vector and string.
-
clean()
- Return a "cleaned up" version of the vector.
-
clean(double)
- Return a "cleaned up" version of the specified double value.
-
clean(String)
- Return a "cleaned up" and named version of the vector.
-
cross(Vector3D)
- Return the vector cross product of this and another vector.
-
dot(Vector3D)
- Return the dot product of this and another vector.
-
equals(Vector3D)
- Determine if the contents of two vectors are equal.
-
getMax()
- Return the largest element of this vector.
-
getPoint(int)
- Return the point which corresponds to the vector.
-
inverse()
- Return the inverse of this vector.
-
length()
- Return the length of this vector.
-
minus(Vector3D)
- Return the difference between this and another vector.
-
negate()
- Return a vector consisting of negated values.
-
normalize()
- Return a normalized version of the vector.
-
plus(Vector3D)
- Return the sum of this and another vector.
-
round(double)
- Return a rounded off vector.
-
roundDouble(double, double)
-
-
scale(double)
- Return the product of this vector and the specified scale factor.
-
setEqual(Vector3D)
- Set the contents of this vector equal to the contents of the
input vector.
-
toString()
- Return a string representation of the vector.
-
toVertex()
- Return a string representation of the vector as a 3D vertex.
-
toVertex2D()
- Return a string representation of the vector as a 2D vertex.
-
total()
- Return the total of the x, y and z elements.
x
public double x
- The vector's x element.
y
public double y
- The vector's y element.
z
public double z
- The vector's z element.
w
public double w
- The vector's w element.
name
public String name
- The name of the vector.
Vector3D
public Vector3D()
- Construct a vector initialized to (0, 0, 0, 1).
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).
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).
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).
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.
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.
clean
public Vector3D clean()
- Return a "cleaned up" version of the vector. Set any value less
than a minimum threshold to 0.
clean
public static double clean(double d)
- Return a "cleaned up" version of the specified double value.
clean
public Vector3D clean(String s)
- Return a "cleaned up" and named version of the vector.
cross
public Vector3D cross(Vector3D vIn)
- Return the vector cross product of this and another vector.
- Returns:
- [this] X [vIn]
dot
public double dot(Vector3D vIn)
- Return the dot product of this and another vector.
- Returns:
- [this] DOT [vIn]
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
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)
getMax
public double getMax()
- Return the largest element of this vector.
inverse
public Vector3D inverse()
- Return the inverse of this vector.
- Returns:
- [1/x, 1/y, 1/z, 1]
length
public double length()
- Return the length of this vector. Return the square root of
x squared plus y squared plus z squared.
minus
public Vector3D minus(Vector3D v)
- Return the difference between this and another vector.
- Returns:
- [this] - [v]
negate
public Vector3D negate()
- Return a vector consisting of negated values.
- Returns:
- [-x, -y, -z, 1]
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.
plus
public Vector3D plus(Vector3D v)
- Return the sum of this and another vector.
- Returns:
- [this] + [v]
scale
public Vector3D scale(double d)
- Return the product of this vector and the specified scale factor.
- Returns:
- [this] * f
setEqual
public void setEqual(Vector3D v)
- Set the contents of this vector equal to the contents of the
input vector.
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.
roundDouble
public static double roundDouble(double n,
double d)
toString
public String toString()
- Return a string representation of the vector.
- Overrides:
- toString in class Object
toVertex
public String toVertex()
- Return a string representation of the vector as a 3D vertex.
toVertex2D
public String toVertex2D()
- Return a string representation of the vector as a 2D vertex.
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