|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metsci.glimpse.util.vector.Vector2d
public final class Vector2d
Basic class representing an immutable vector containing 2 doubles. All inputs and outputs are in system units.
Constructor Summary | |
---|---|
Vector2d()
|
|
Vector2d(double x,
double y)
|
Method Summary | |
---|---|
double |
angleWith(Vector2d v)
Returns the conical (unsigned) angle between this vector and vector v. |
double |
azimuthAngle()
|
double |
cosAngleWith(Vector2d v)
Returns cosine of the angle between this vector and vector v. |
static Vector2d |
createPolar(double radius,
double theta)
Create Vector2d from polar coordinates. |
static Vector2d |
createPolarTranslated(double radius,
double theta,
double translateX,
double translateY)
Create Vector2d from polar coordinates with given translation of origin. |
double |
distance(Vector2d v)
|
double |
distanceSquared(Vector2d v)
|
double |
dotProduct(Vector2d v)
|
boolean |
equals(java.lang.Object o)
|
java.lang.String |
format(java.lang.String coordFormat)
Get formatted String representation. |
static Vector2d |
fromArray(double[] coords)
|
double |
getX()
|
double |
getY()
|
int |
hashCode()
|
boolean |
isZero()
|
static Vector2d |
linearCombination(double[] a,
Vector2d[] w)
|
static Vector2d |
linearCombination(double a1,
Vector2d v1,
double a2,
Vector2d v2)
|
Vector2d |
minus(Vector2d v)
|
double |
norm()
|
Vector2d |
normalized()
Returns normalized (rescaled to norm = 1) version of this vector. |
Vector2d |
normalizedLenient()
Returns normalized (rescaled to norm = 1) version of this vector. |
double |
normSquared()
|
Vector2d |
perpendicularVector()
Returns a vector perpendicular to this one, with same norm. |
Vector2d |
plus(Vector2d v)
|
Vector2d |
projectionOnto(Vector2d v)
Returns the projection of this vector onto the vector v. |
Vector2d |
rotatedAboutOriginBy(double theta)
|
Vector2d |
scalarProduct(double alpha)
|
Vector2d |
scaledBy(double scaleFactor)
|
double[] |
toArray()
|
java.lang.String |
toString()
|
Vector3d |
toVector3d(double z)
Concatenate z component to form ThreeVector. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Vector2d(double x, double y)
public Vector2d()
Method Detail |
---|
public double getX()
public double getY()
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 java.lang.String toString()
toString
in class java.lang.Object
public Vector2d plus(Vector2d v)
public Vector2d minus(Vector2d v)
public Vector2d scalarProduct(double alpha)
public Vector2d scaledBy(double scaleFactor)
public double dotProduct(Vector2d v)
public double azimuthAngle()
public double normSquared()
public double norm()
public boolean isZero()
public Vector2d normalized()
Note: "Strict" version: if zero vector, returned vector will contain all NaN values and a warning will be logged.
public Vector2d normalizedLenient()
Note: "Lenient" version: If zero vector, returned vector will be (1, 0).
public double distanceSquared(Vector2d v)
public double distance(Vector2d v)
public double cosAngleWith(Vector2d v)
public double angleWith(Vector2d v)
public Vector2d projectionOnto(Vector2d v)
public Vector2d rotatedAboutOriginBy(double theta)
theta
- rotation angle
public Vector2d perpendicularVector()
public Vector3d toVector3d(double z)
z
-
public double[] toArray()
public static Vector2d fromArray(double[] coords)
public static Vector2d createPolar(double radius, double theta)
radius
- distance from center (0,0)theta
- azimuth angle
public static Vector2d createPolarTranslated(double radius, double theta, double translateX, double translateY)
radius
- distance from center (translateX, translateY)theta
- azimuth angletranslateX
- translateY
-
public static Vector2d linearCombination(double a1, Vector2d v1, double a2, Vector2d v2)
public static Vector2d linearCombination(double[] a, Vector2d[] w)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |