public final class Vector3d extends Object implements Serializable
Constructor and Description |
---|
Vector3d()
Default constructor.
|
Vector3d(double x,
double y,
double z)
Standard constructor.
|
Modifier and Type | Method and Description |
---|---|
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(Object o) |
String |
format(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,
boolean isLenient)
Returns the projection of this vector onto the vector v.
|
Vector3d |
projectOnto(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 |
rotated(double theta,
Vector3d axis) |
Vector3d |
rotatedAboutXAxisBy(double theta) |
Vector3d |
rotatedAboutYAxisBy(double theta) |
Vector3d |
rotatedAboutZAxisBy(double theta) |
Vector3d |
scalarProduct(double alpha)
Deprecated.
use
scaledBy(double) |
Vector3d |
scaledBy(double scaleFactor) |
double[] |
toArray() |
String |
toString() |
Vector3d |
withZ(double z) |
public Vector3d(double x, double y, double z)
x
- y
- z
- public Vector3d()
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-coordinatepublic double getX()
public double getY()
public double getZ()
public Vector2d getXY()
public String format(String coordFormat)
coordFormat
- format applied to each coordinate (as in String.format)public double[] toArray()
public static Vector3d fromArray(double[] coords)
@Deprecated public Vector3d scalarProduct(double alpha)
scaledBy(double)
public Vector3d scaledBy(double scaleFactor)
public double dotProduct(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 rotated(double theta, Vector3d axis)
theta
- rotation angle around the specified axis.axis
- the axis about which to rotate.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 projectOnto(Vector3d v)
for lenient handling of v
public Vector3d projectionOnto(Vector3d v, boolean isLenient)
public Vector3d reflectionThroughPlaneAt(Vector3d x0, Vector3d normal)
x0
- point on the planenormal
- normal to the planepublic 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)
Copyright © 2018 Metron, Inc.. All rights reserved.