|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectVector
public class Vector
Represents a vector in three-dimensional space.
Field Summary | |
---|---|
static Vector |
ZERO
The zero vector, with zero in all components. |
Method Summary | |
---|---|
Vector |
add(Vector other)
Returns the sum of this vector and the parameter vector. |
static Vector |
create(double x,
double y,
double z)
Creates a vector with the given components. |
Vector |
cross(Vector other)
Returns the cross-product of this vector and the parameter vector. |
double |
dot(Vector other)
Returns the dot-product of this vector and the parameter vector. |
double |
dotPoint(Point other)
Returns the dot-product of this vector and the vector from the origin to the parameter point. |
double |
getLength()
Returns the length of this vector. |
double |
getLengthSquared()
Returns the square of the length of this vector. |
double |
getX()
Returns the x-component of this vector. |
double |
getY()
Returns the y-component of this vector. |
double |
getZ()
Returns the z-component of this vector. |
Vector |
normalize()
Returns a vector in the same direction as this one, but whose length is one. |
Vector |
projectOnto(Vector other)
Returns the vector resulting from projecting this vector onto the given vector's direction. |
Vector |
scale(double scalar)
Returns a copy of this vector scaled by the given vector. |
Vector |
subtract(Vector other)
Returns the difference of this vector and the parameter vector. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Vector ZERO
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public double getX()
public double getY()
public double getZ()
public double getLengthSquared()
public double getLength()
public Vector normalize()
public double dot(Vector other)
public double dotPoint(Point other)
public Vector cross(Vector other)
public Vector add(Vector other)
public Vector subtract(Vector other)
public Vector projectOnto(Vector other)
public Vector scale(double scalar)
public static Vector create(double x, double y, double z)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |