|
Rings Version 0.3 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectthreeD.raytracer.util.Vector
A Vector object represents a 3d vector. It stores three coordinates, x, y, z.
| Field Summary | |
static int |
CARTESIAN_COORDINATES
|
static int |
SPHERICAL_COORDINATES
|
| Constructor Summary | |
Vector()
Constructs a Vector object with coordinates at the origin. |
|
Vector(double x,
double y,
double z)
Constructs a new Vector object using the specified cartesian coordinates. |
|
Vector(double x,
double y,
double z,
int coordSys)
Constructs a new Vector object using the specified coordinates. |
|
| Method Summary | |
Vector |
add(Vector vector)
Returns the sum of the vector represented by this Vector object and that of the specified Vector object. |
void |
addTo(Vector vector)
Adds the vector represented by the specified Vector object to this Vector object. |
java.lang.Object |
clone()
|
Vector |
crossProduct(Vector vector)
Returns the cross product of the vector represented by this Vector object and that of the specified Vector object. |
Vector |
divide(double value)
Returns the quotient of the division of the vector represented by this Vector object by the specified value. |
void |
divideBy(double value)
Divides the vector represented by this Vector object by the specified double value. |
double |
dotProduct(Vector vector)
Returns the dot product of the vector represented by this Vector object and that of the specified Vector object. |
boolean |
equals(java.lang.Object obj)
Returns true if and only if the object specified represents a 3d vector that is geometrically equal to the vector represented by this Vector object. |
double |
getX()
Returns the X coordinate of this Vector object. |
double |
getY()
Returns the Y coordinate of this Vector object. |
double |
getZ()
Returns the Z coordinate of this Vector object. |
int |
hashCode()
Returns an integer hash code value for this Vector object obtained by adding all 3 components and casting to an int. |
double |
length()
Returns the length of the vector represented by this Vector object as a double value. |
double |
lengthSq()
Returns the squared length of the vector represented by this Vector object as a double value. |
Vector |
minus()
Returns the opposite of the vector represented by this Vector object. |
Vector |
multiply(double value)
Returns the product of the vector represented by this Vector object and the specified value. |
void |
multiplyBy(double value)
Multiplies the vector represented by this Vector object by the specified double value. |
void |
setX(double x)
Sets the X coordinate of this Vector object. |
void |
setY(double y)
Sets the Y coordinate of this Vector object. |
void |
setZ(double z)
Sets the Z coordinate of this Vector object. |
Vector |
subtract(Vector vector)
Returns the difference of the vector represented by this Vector object and that of the specified Vector object. |
void |
subtractFrom(Vector vector)
Subtracts the vector represented by the specified Vector object from this Vector object. |
java.lang.String |
toString()
Returns a String representation of this Vector object. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int CARTESIAN_COORDINATES
public static final int SPHERICAL_COORDINATES
| Constructor Detail |
public Vector()
public Vector(double x,
double y,
double z,
int coordSys)
x - Cartesian X coordinate or spherical distance from origin.y - Cartesian Y coordinate or angle from positive Z axis (rads).z - Cartesian Z coordinate or angle from positive XY plane (rads).coordSys - Vector.CARTESIAN_COORDINATES or Vector.SPHERICAL_COORDINATES.
public Vector(double x,
double y,
double z)
| Method Detail |
public void setX(double x)
public void setY(double y)
public void setZ(double z)
public double getX()
public double getY()
public double getZ()
public Vector minus()
public Vector add(Vector vector)
public void addTo(Vector vector)
vector - The Vector object to add.public Vector subtract(Vector vector)
public void subtractFrom(Vector vector)
vector - The Vector object to be subtracted.public Vector multiply(double value)
public void multiplyBy(double value)
value - The factor to multiply by.public Vector divide(double value)
public void divideBy(double value)
value - The value to divide by.public double dotProduct(Vector vector)
public Vector crossProduct(Vector vector)
public double length()
public double lengthSq()
public int hashCode()
public boolean equals(java.lang.Object obj)
public java.lang.Object clone()
java.lang.Object.clone()public java.lang.String toString()
|
Rings Version 0.3 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||