|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metsci.glimpse.util.vector.Vector3d
public final class Vector3d
Basic class representing an immutable vector containing 3 doubles. All inputs and outputs are in system units.
Constructor Summary | |
---|---|
Vector3d()
Default constructor. |
|
Vector3d(double x,
double y,
double z)
Standard constructor. |
Method Summary | |
---|---|
double |
angleWith(Vector3d v)
Returns the conical (unsigned) angle between this vector and vector v. |
double |
cosAngleWith(Vector3d v)
Returns cosine of the angle between this vector and vector v. |
static Vector3d |
createCylindrical(double radius,
double theta,
double z)
Create Vector3d from cylindrical coordinates. |
Vector3d |
crossProduct(Vector3d v)
|
double |
distance(Vector3d v)
|
double |
distanceOnXYPlane(Vector2d v)
|
double |
distanceOnXYPlane(Vector3d v)
|
double |
distanceOnXYPlaneSquared(Vector2d v)
|
double |
distanceOnXYPlaneSquared(Vector3d v)
|
double |
distanceSquared(Vector3d v)
|
double |
dotProduct(Vector3d v)
|
double |
elevationAngle()
Returns the conical angle between this vector and the xy-plane. |
boolean |
equals(java.lang.Object o)
|
java.lang.String |
format(java.lang.String coordFormat)
Get formatted String representation. |
static Vector3d |
fromArray(double[] coords)
|
double |
getX()
|
Vector2d |
getXY()
|
double |
getY()
|
double |
getZ()
|
int |
hashCode()
|
double |
horizontalAzimuthAngle()
Returns the azimuth angle of the projection of this vector on the xy-plane. |
double |
horizontalAzimuthAngleFast()
Returns the azimuth angle of the projection of this vector on the xy-plane. |
static Vector3d |
interpolate(double t,
Vector3d v0,
Vector3d v1)
Linear interpolation between vectors v0 and v1. |
boolean |
isValid()
False if any of the coordinates is NaN or Infinite. |
boolean |
isZero()
|
static Vector3d |
linearCombination(double[] a,
Vector3d[] w)
|
static Vector3d |
linearCombination(double a1,
Vector3d v1,
double a2,
Vector3d v2)
|
static Vector3d |
linearCombination(double a1,
Vector3d v1,
double a2,
Vector3d v2,
double a3,
Vector3d v3)
|
Vector3d |
minus(Vector3d v)
|
double |
norm()
|
Vector3d |
normalized()
Returns normalized (rescaled to norm = 1) version of this vector. |
Vector3d |
normalizedLenient()
Returns normalized (rescaled to norm = 1) version of this vector. |
double |
normSquared()
|
Vector3d[] |
orthonormalVectors()
Returns unit vectors w0 and w1 which are orthogonal to this vector and each other. |
double |
phiAngle()
Returns the conical angle between this vector and the positive z axis. |
Vector3d |
plus(Vector3d v)
|
Vector3d |
projectionOnto(Vector3d v)
Returns the projection of this vector onto the vector v. |
Vector3d |
reflectionThroughPlaneAt(Vector3d x0,
Vector3d normal)
Returns reflection of this vector through a plane specified by a point on the plane and a vector normal to the plane. |
Vector3d |
rotatedAboutXAxisBy(double theta)
|
Vector3d |
rotatedAboutYAxisBy(double theta)
|
Vector3d |
rotatedAboutZAxisBy(double theta)
|
Vector3d |
scalarProduct(double alpha)
|
Vector3d |
scaledBy(double scaleFactor)
|
double[] |
toArray()
|
java.lang.String |
toString()
|
Vector3d |
withZ(double z)
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Vector3d(double x, double y, double z)
x
- y
- z
- public Vector3d()
Method Detail |
---|
public static Vector3d createCylindrical(double radius, double theta, double z)
Note: Negative radius is allowed. This reverses the vector direction in x and y.
radius
- distance from z-axis (XY plane projection radius)theta
- horizontal azimuth angle (XY plane projection theta)z
- z-coordinate
public double getX()
public double getY()
public double getZ()
public Vector2d getXY()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String format(java.lang.String coordFormat)
coordFormat
- format applied to each coordinate (as in String.format)
public double[] toArray()
public static Vector3d fromArray(double[] coords)
public java.lang.String toString()
toString
in class java.lang.Object
public Vector3d plus(Vector3d v)
public Vector3d minus(Vector3d v)
public Vector3d scalarProduct(double alpha)
public Vector3d scaledBy(double scaleFactor)
public double dotProduct(Vector3d v)
public Vector3d crossProduct(Vector3d v)
public double normSquared()
public double distanceSquared(Vector3d v)
public double distance(Vector3d v)
public double norm()
public boolean isZero()
public double distanceOnXYPlaneSquared(Vector2d v)
public double distanceOnXYPlane(Vector2d v)
public double distanceOnXYPlaneSquared(Vector3d v)
public double distanceOnXYPlane(Vector3d v)
public boolean isValid()
public Vector3d withZ(double z)
public Vector3d normalized()
Note: "Strict" version: if zero vector, returned vector will contain all NaN values and a warning will be logged.
public Vector3d normalizedLenient()
Note: "Lenient" version: If zero vector, returned vector will be (1, 0, 0).
public double horizontalAzimuthAngle()
public double horizontalAzimuthAngleFast()
Note: This version uses a faster, less accurate, calculation.
public double phiAngle()
public double elevationAngle()
public Vector3d rotatedAboutXAxisBy(double theta)
theta
- rotation angle around the x-axis.
public Vector3d rotatedAboutYAxisBy(double theta)
theta
- rotation angle around the y-axis.
public Vector3d rotatedAboutZAxisBy(double theta)
theta
- rotation angle around the z-axis.
public double cosAngleWith(Vector3d v)
public double angleWith(Vector3d v)
public Vector3d projectionOnto(Vector3d v)
public Vector3d reflectionThroughPlaneAt(Vector3d x0, Vector3d normal)
x0
- point on the planenormal
- normal to the plane
public Vector3d[] orthonormalVectors()
public static Vector3d linearCombination(double a1, Vector3d v1, double a2, Vector3d v2)
public static Vector3d linearCombination(double a1, Vector3d v1, double a2, Vector3d v2, double a3, Vector3d v3)
public static Vector3d linearCombination(double[] a, Vector3d[] w)
public static Vector3d interpolate(double t, Vector3d v0, Vector3d v1)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |