|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jinx.slowmath.Vector
public class Vector
Vector is a set of three Real objects, as X/Y/Z coordinates. There are
operations for regular math (that function on all three seperately), as well
as operations that are Vector specific.
Vector is completely type neutral.
API Stability: Beta.
Constructor Summary | |
---|---|
Vector()
|
|
Vector(Real[] vec)
Constructs a new Vector with the given X/Y/Z coordinates. |
|
Vector(Real x,
Real y,
Real z)
Constructs a new Vector with the given X/Y/Z coordinates. |
|
Vector(java.lang.String s)
Constructs a new Vector by parsing the given String. |
Method Summary | |
---|---|
Vector |
abs()
Returns a Vector whose components have had their sign removed. |
Vector |
add(Real v)
Returns the result of adding v to this Vector. |
Vector |
add(Vector v)
Returns the result of adding v to this Vector. |
Vector |
cross(Vector v)
Returns a Vector whose value is the cross product of this and v. |
Vector |
divide(Real v)
Returns the result of this Vector divided by v. |
Vector |
divide(Vector v)
Returns the result of this Vector divided by v. |
Real |
dot(Vector v)
Returns a Vector whose value is the dot product of this and v. |
Real |
getX()
Provides the X coordinate. |
Real |
getY()
Provides the Y coordinate. |
Real |
getZ()
Provides the Z coordinate. |
Real |
magnitude()
Returns the the following: sqrt(X*X + Y*Y + Z*Z). |
Vector |
multiply(Real v)
Returns the result of multiplying v with this Vector. |
Vector |
multiply(Vector v)
Returns the result of multiplying v with this Vector. |
Vector |
negate()
Negates each component of this Vector. |
Vector |
normalize()
Divides this Vector by it's magnitude to produce a normalized version of it. |
Vector |
subtract(Real v)
Returns the result of subtracting v from this Vector. |
Vector |
subtract(Vector v)
Returns the result of subtracting v from this Vector. |
double[] |
toDoubleArray()
Converts this Vector to a double array. |
float[] |
toFloatArray()
Converts this Vector to a float array. |
java.lang.String |
toString()
Provides a String representation of this Vector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Vector()
public Vector(Real x, Real y, Real z)
x
- the X coordinate.y
- the Y coordinate.z
- the Z coordinate.public Vector(Real[] vec)
vec
- the coordinates in an array.public Vector(java.lang.String s)
s
- the String to parse.Method Detail |
---|
public Real getX()
public Real getY()
public Real getZ()
public Vector abs()
public Real dot(Vector v)
v
- the Vector to use.
public Vector cross(Vector v)
v
- the Vector to use.
public Vector add(Vector v)
v
- the Vector to add.
public Vector add(Real v)
v
- the Real to add.
public Vector subtract(Vector v)
v
- the Vector to subtract.
public Vector subtract(Real v)
v
- the Real to subtract.
public Vector multiply(Vector v)
v
- the Vector to multiply.
public Vector multiply(Real v)
v
- the Real to multiply.
public Vector divide(Vector v)
v
- the Vector to divide by.
public Vector divide(Real v)
v
- the Real to divide by.
public Real magnitude()
public Vector negate()
public Vector normalize()
public float[] toFloatArray()
public double[] toDoubleArray()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |