|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkeps.math.Tuple3
keps.math.Vector3
public class Vector3
GENERAL CONTRACT FOR ALL MATH CLASSES. -- The destination of every method is assumed to be the object the method was called on. For example: c.add(a,b) means c = a + b. -- Whenever one operand of a binary operand is missing, it is assumed to be the object the method was called upon. For example: c.add(a) means c = c + a. The Vector3 class represents a 3 dimension vector of doubles.
Field Summary |
---|
Fields inherited from class keps.math.Tuple3 |
---|
x, y, z |
Constructor Summary | |
---|---|
Vector3()
Default constructor. |
|
Vector3(double newX,
double newY,
double newZ)
The explicit constructor. |
|
Vector3(Tuple3 newTuple)
Copy constructor. |
Method Summary | |
---|---|
void |
add(Vector3 vector)
Add a Vector3 to this Vector3 |
void |
add(Vector3 v1,
Vector3 v2)
Add the values of Vector3 v1 and Vector3 v2 and store the sum in this Vector3. |
void |
cross(Vector3 op1,
Vector3 op2)
Sets this vector to the cross product of op1 and op2 |
double |
dot(Vector3 rhs)
Returns the dot product of this Vector3 object and the parameter Vector3. |
double |
length()
Returns the length of this vector. |
double |
lengthsquared()
Returns the length squared of this vector. |
void |
normalize()
This method will normalize this Vector3 so that its length is 1.0. |
void |
scaleAdd(double scale,
Tuple3 vector)
Add a scalar multiple of a Vector3 to this Vector3 |
void |
sub(Point3 p1,
Point3 p2)
Subtract one Point3 from another Point3 and set as this Vector |
void |
sub(Vector3 vector)
Substract a Vector3 from this Vector3 |
Methods inherited from class keps.math.Tuple3 |
---|
scale, set, set, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Vector3()
public Vector3(Tuple3 newTuple)
newTuple
- The vector to copy.public Vector3(double newX, double newY, double newZ)
newX
- The x value of the new vector.newY
- The y value of the new vector.newZ
- The z value of the new vector.Method Detail |
---|
public void cross(Vector3 op1, Vector3 op2)
op1
- op2
- public double dot(Vector3 rhs)
rhs
- The right hand operand.
public double length()
public double lengthsquared()
public void normalize()
public void add(Vector3 vector)
vector
- the Vector3 to addpublic void add(Vector3 v1, Vector3 v2)
v1
- the first operandv2
- the second operandpublic void sub(Vector3 vector)
vector
- the Tuple3 to subtractpublic void sub(Point3 p1, Point3 p2)
p1
- the first operandp2
- the second operandpublic void scaleAdd(double scale, Tuple3 vector)
scale
- the scale factorvector
- the vector to scale add
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |