public class Vector3D
extends java.lang.Object
Constructor and Description |
---|
Vector3D() |
Vector3D(double[] xyz) |
Vector3D(double X,
double Y,
double Z) |
Vector3D(Point3D p1,
Point3D p0)
Construct vector (p1 - p0) from two points.
|
Vector3D(Vector3D v) |
Modifier and Type | Method and Description |
---|---|
Vector3D |
cross(Vector3D v)
Gives vector (cross) product of this with another vector.
|
double |
dot(Vector3D v)
Gives scalar (dot) product of this with another vector.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
Vector3D |
minus(Vector3D v)
Subtract another vector from this one.
|
double |
mod() |
double |
modSquared() |
Vector3D |
negated()
Get the negated version of this vector
|
Vector3D |
normalized() |
Vector3D |
plus(Vector3D v)
Add another vector to this one.
|
Vector3D |
rotate(double alpha,
Vector3D axis) |
Vector3D |
scaled(double factor)
Scale vector by some constant.
|
static double[] |
thetaPhi(Vector3D v) |
Matrix |
toJamaMatrix() |
RealMatrix |
toRealMatrix() |
java.lang.String |
toString() |
static Vector3D |
vectorFromSPC(double r,
double theta,
double phi)
Get a Cartesian vector from the spherical polar coordinates.
|
public Vector3D()
public Vector3D(double X, double Y, double Z)
public Vector3D(double[] xyz)
public Vector3D(Vector3D v)
public static Vector3D vectorFromSPC(double r, double theta, double phi)
r
- the magnitude of the vectortheta
- cos theta is the dot product of this vector.normalized() with the Z axis.phi
- the angle with the positive X axis, between 0 and 2 * PI.public double dot(Vector3D v)
v
- the vector to take the scalar product with.public Vector3D cross(Vector3D v)
v
- the vector to cross with.public Vector3D negated()
public Vector3D plus(Vector3D v)
v
- the vector to add.public Vector3D minus(Vector3D v)
v
- the vector to subtract from this.public Vector3D normalized()
public double mod()
public double modSquared()
public Vector3D scaled(double factor)
factor
- the factor to scale by.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public RealMatrix toRealMatrix()
public Matrix toJamaMatrix()
public static double[] thetaPhi(Vector3D v)
v
- Should be a unit vector but no warning will be given if it is not.