Modifier and Type | Field and Description |
---|---|
static Point2S |
MINUS_I
-I (coordinates: ( azimuth = pi, polar = pi/2 )).
|
static Point2S |
MINUS_J
-J (coordinates: ( azimuth = 3pi/2, polar = pi/2 )).
|
static Point2S |
MINUS_K
-K (coordinates: ( azimuth = any angle, polar = pi )).
|
static Point2S |
NaN
A point with all coordinates set to NaN.
|
static Point2S |
PLUS_I
+I (coordinates: ( azimuth = 0, polar = pi/2 )).
|
static Point2S |
PLUS_J
+J (coordinates: ( azimuth = pi/2, polar = pi/2 ))).
|
static Point2S |
PLUS_K
+K (coordinates: ( azimuth = any angle, polar = 0 )).
|
static Comparator<Point2S> |
POLAR_AZIMUTH_ASCENDING_ORDER
Comparator that sorts points in component-wise ascending order, first sorting
by polar value and then by azimuth value.
|
Modifier and Type | Method and Description |
---|---|
Point2S |
antipodal()
Get the point exactly opposite this point on the sphere.
|
double |
distance(Point2S point) |
static double |
distance(Point2S p1,
Point2S p2)
Compute the distance (angular separation) between two points.
|
boolean |
eq(Point2S point,
Precision.DoubleEquivalence precision)
Return true if this point should be considered equivalent to the argument using the
given precision context.
|
boolean |
equals(Object other)
Test for the equality of two points.
|
static Point2S |
from(Vector3D vector)
Build a point from its underlying 3D vector.
|
double |
getAzimuth()
Get the azimuth angle in the x-y plane in the range
[0, 2pi) . |
int |
getDimension() |
double |
getPolar()
Get the polar angle in the range
[0, pi) . |
Vector3D.Unit |
getVector()
Get the corresponding normalized vector in 3D Euclidean space.
|
int |
hashCode()
Get a hashCode for the point.
|
boolean |
isFinite() |
boolean |
isInfinite() |
boolean |
isNaN() |
static Point2S |
of(double azimuth,
double polar)
Build a vector from its spherical coordinates.
|
static Point2S |
parse(String str)
Parses the given string and returns a new point instance.
|
Point2S |
slerp(Point2S other,
double t)
Spherically interpolate a point along the shortest arc between this point and
the given point.
|
String |
toString() |
public static final Comparator<Point2S> POLAR_AZIMUTH_ASCENDING_ORDER
public double getAzimuth()
[0, 2pi)
.[0, 2pi)
.of(double, double)
public double getPolar()
[0, pi)
.[0, pi)
.of(double, double)
public Vector3D.Unit getVector()
public int getDimension()
getDimension
in interface Spatial
public boolean isInfinite()
isInfinite
in interface Spatial
public Point2S antipodal()
pi
distance away from the current instance.public Point2S slerp(Point2S other, double t)
t
controls the interpolation and is expected
to be in the range [0, 1]
, with 0
returning a point equivalent to the
current instance 1
returning a point equivalent to the given instance. If the
points are antipodal, then an arbitrary arc is chosen from the infinite number available.other
- other point to interpolate witht
- interpolation parameterQuaternionRotation.slerp(QuaternionRotation)
,
QuaternionRotation.createVectorRotation(Vector3D, Vector3D)
public boolean eq(Point2S point, Precision.DoubleEquivalence precision)
point
- point to compare withprecision
- precision context used to perform floating point comparisonspublic int hashCode()
All NaN values have the same hash code.
public boolean equals(Object other)
If all spherical coordinates of two points are exactly the same, and none are
Double.NaN
, the two points are considered to be equal. Note
that the comparison is made using the azimuth and polar coordinates only; the
corresponding 3D vectors are not compared. This is significant at the poles,
where an infinite number of points share the same underlying 3D vector but may
have different spherical coordinates. For example, the points (0, 0)
and (1, 0)
(both located at a pole but with different azimuths) will
not be considered equal by this method, even though they share the
exact same underlying 3D vector.
NaN
coordinates are considered to affect the point globally
and be equals to each other - i.e, if either (or all) coordinates of the
point are equal to Double.NaN
, the point is equal to
NaN
.
public static Point2S of(double azimuth, double polar)
azimuth
- azimuthal angle in the x-y planepolar
- polar anglegetAzimuth()
,
getPolar()
public static Point2S from(Vector3D vector)
vector
- 3D vectorIllegalStateException
- if vector norm is zeropublic static Point2S parse(String str)
toString()
.str
- the string to parseIllegalArgumentException
- if the given string has an invalid formatCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.