public class Vector3 extends Tuple3
Constructor and Description |
---|
Vector3()
Constructs a vector with components zero.
|
Vector3(double x,
double y,
double z)
Constructs a vector with specified components.
|
Vector3(Vector3 v)
Constructs a copy of the specified vector.
|
Modifier and Type | Method and Description |
---|---|
Vector3 |
cross(Vector3 v)
Returns the cross product of this vector u and the specified vector v.
|
double |
dot(Vector3 v)
Returns the dot product of this vector u and the specified vector v.
|
double |
length()
Returns the length of this vector.
|
double |
lengthSquared()
Returns the length-squared of this vector.
|
Vector3 |
minus(Vector3 v)
Returns the vector difference u-v for this vector u.
|
Vector3 |
minusEquals(Vector3 v)
Subtracts a vector v from this vector u.
|
Vector3 |
negate()
Returns the negation -u of this vector u.
|
Vector3 |
negateEquals()
Negates this vector.
|
Vector3 |
normalize()
Returns the unit vector with the same direction as this vector.
|
Vector3 |
normalizeEquals()
Normalizes this vector to have unit length; makes this a unit vector.
|
Vector3 |
plus(Vector3 v)
Returns the vector sum u+v for this vector u.
|
Vector3 |
plusEquals(Vector3 v)
Adds a vector v to this vector u.
|
Vector3 |
times(double s)
Returns the scaled vector s*u for this vector u.
|
Vector3 |
timesEquals(double s)
Scales this vector.
|
public Vector3()
public Vector3(double x, double y, double z)
x
- the x component.y
- the y component.z
- the z component.public Vector3(Vector3 v)
v
- the vector.public double length()
public double lengthSquared()
public Vector3 negate()
public Vector3 negateEquals()
public Vector3 normalize()
public Vector3 normalizeEquals()
public Vector3 plus(Vector3 v)
v
- the other vector.public Vector3 plusEquals(Vector3 v)
v
- the other vector.public Vector3 minus(Vector3 v)
v
- the other vector.public Vector3 minusEquals(Vector3 v)
v
- the other vector.public Vector3 times(double s)
s
- the scale factor.public Vector3 timesEquals(double s)
s
- the scale factor.public double dot(Vector3 v)
v
- the vector v.