Class Point2S
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Point2S-I (coordinates: ( azimuth = pi, polar = pi/2 )).static final Point2S-J (coordinates: ( azimuth = 3pi/2, polar = pi/2 )).static final Point2S-K (coordinates: ( azimuth = any angle, polar = pi )).static final Point2SA point with all coordinates set to NaN.static final Point2S+I (coordinates: ( azimuth = 0, polar = pi/2 )).static final Point2S+J (coordinates: ( azimuth = pi/2, polar = pi/2 ))).static final Point2S+K (coordinates: ( azimuth = any angle, polar = 0 )).static final Comparator<Point2S> Comparator that sorts points in component-wise ascending order, first sorting by polar value and then by azimuth value. -
Method Summary
Modifier and TypeMethodDescriptionGet the point exactly opposite this point on the sphere.doubleCompute the distance between this point and another point.static doubleCompute the distance (angular separation) between two points.booleanReturn true if this point should be considered equivalent to the argument using the given precision context.booleanTest for the equality of two points.static Point2SBuild a point from its underlying 3D vector.doubleGet the azimuth angle in the x-y plane in the range[0, 2pi).intReturns the number of dimensions in the space that this element belongs to.doublegetPolar()Get the polar angle in the range[0, pi).Get the corresponding normalized vector in 3D Euclidean space.inthashCode()Get a hashCode for the point. .booleanisFinite()Returns true if all values in this element are finite, meaning they are not NaN or infinite.booleanReturns true if any value in this element is infinite and none are NaN; otherwise, returns false.booleanisNaN()Returns true if any value in this element is NaN; otherwise returns false.static Point2Sof(double azimuth, double polar) Build a vector from its spherical coordinates.static Point2SParses the given string and returns a new point instance.Spherically interpolate a point along the shortest arc between this point and the given point.toString()
-
Field Details
-
PLUS_I
-
PLUS_J
-
PLUS_K
-
MINUS_I
-
MINUS_J
-
MINUS_K
-
NaN
-
POLAR_AZIMUTH_ASCENDING_ORDER
Comparator that sorts points in component-wise ascending order, first sorting by polar value and then by azimuth value. Points are only considered equal if their components match exactly. Null arguments are evaluated as being greater than non-null arguments.
-
-
Method Details
-
getAzimuth
Get the azimuth angle in the x-y plane in the range[0, 2pi).- Returns:
- azimuth angle in the x-y plane in the range
[0, 2pi). - See Also:
-
getPolar
Get the polar angle in the range[0, pi).- Returns:
- polar angle in the range
[0, pi). - See Also:
-
getVector
Get the corresponding normalized vector in 3D Euclidean space. This value will be null if the spherical coordinates of the point are infinite or NaN.- Returns:
- normalized vector
-
getDimension
Returns the number of dimensions in the space that this element belongs to.- Specified by:
getDimensionin interfaceSpatial- Returns:
- the number of dimensions in the element's space
-
isNaN
-
isInfinite
Returns true if any value in this element is infinite and none are NaN; otherwise, returns false.- Specified by:
isInfinitein interfaceSpatial- Returns:
- true if any value in this element is infinite and none are NaN
-
isFinite
-
antipodal
-
distance
-
slerp
Spherically interpolate a point along the shortest arc between this point and the given point. The parametertcontrols the interpolation and is expected to be in the range[0, 1], with0returning a point equivalent to the current instance1returning a point equivalent to the given instance. If the points are antipodal, then an arbitrary arc is chosen from the infinite number available.- Parameters:
other- other point to interpolate witht- interpolation parameter- Returns:
- spherically interpolated point
- See Also:
-
eq
public boolean eq(Point2S point, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return true if this point should be considered equivalent to the argument using the given precision context. This will be true if the distance between the points is equivalent to zero as evaluated by the precision context.- Parameters:
point- point to compare withprecision- precision context used to perform floating point comparisons- Returns:
- true if this point should be considered equivalent to the argument using the given precision context
-
hashCode
-
equals
Test for the equality of two points.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.NaNcoordinates 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 toDouble.NaN, the point is equal toNaN. -
toString
-
of
-
from
Build a point from its underlying 3D vector.- Parameters:
vector- 3D vector- Returns:
- point instance with the coordinates determined by the given 3D vector
- Throws:
IllegalStateException- if vector norm is zero
-
parse
Parses the given string and returns a new point instance. The expected string format is the same as that returned bytoString().- Parameters:
str- the string to parse- Returns:
- point instance represented by the string
- Throws:
IllegalArgumentException- if the given string has an invalid format
-
distance
-