Class CutAngle
- All Implemented Interfaces:
Hyperplane<Point1S>
Hyperplanes split the spaces they are embedded in into three distinct parts:
the hyperplane itself, a plus side and a minus side. However, since spherical
space wraps around, a single oriented point is not sufficient to partition the space;
any point could be classified as being on the plus or minus side of a hyperplane
depending on the direction that the circle is traversed. The approach taken in this
class to address this issue is to (1) define a second, implicit cut point at 0pi
and
(2) define the domain of hyperplane points (for partitioning purposes) to be the
range [0, 2pi)
. Each hyperplane then splits the space into the intervals
[0, x]
and [x, 2pi)
, where x
is the location of the hyperplane.
One way to visualize this is to picture the circle as a cake that has already been
cut at 0pi
. Each hyperplane then specifies the location of the second
cut of the cake, with the plus and minus sides being the pieces thus cut.
Note that with the hyperplane partitioning rules described above, the hyperplane
at 0pi
is unique in that it has the entire space on one side (minus the hyperplane
itself) and no points whatsoever on the other. This is very different from hyperplanes in
Euclidean space, which always have infinitely many points on both sides.
Instances of this class are guaranteed to be immutable.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
HyperplaneConvexSubset
implementation for spherical 1D space. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Point1S
Hyperplane location as a point.private final boolean
Hyperplane direction. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClassify a point with respect to this hyperplane.boolean
Return true if this instance should be considered equivalent to the argument, using the given precision context for comparison.boolean
double
Get the location of the hyperplane as a single value.double
Get the location of the hyperplane as a single value, normalized to the range[0, 2pi)
.getPoint()
Get the location of the hyperplane as a point.int
hashCode()
boolean
Return true if the hyperplane is oriented with its plus side pointing toward increasing angles.double
Get the offset (oriented distance) of a point with respect to this instance.Project a point onto this instance.reverse()
Return a hyperplane that has the opposite orientation as this instance.boolean
similarOrientation
(Hyperplane<Point1S> other) Return true if this instance has a similar orientation to the given hyperplane, meaning that they point in generally the same direction.span()
Return aHyperplaneConvexSubset
spanning this entire hyperplane.toString()
Transform this instance using the givenTransform
.Methods inherited from class org.apache.commons.geometry.core.partitioning.AbstractHyperplane
contains, getPrecision
-
Field Details
-
point
Hyperplane location as a point. -
positiveFacing
private final boolean positiveFacingHyperplane direction.
-
-
Constructor Details
-
CutAngle
CutAngle(Point1S point, boolean positiveFacing, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Simple constructor.- Parameters:
point
- location of the hyperplanepositiveFacing
- if true, the hyperplane will point in a positive angular direction; otherwise, it will point in a negative directionprecision
- precision context used to compare floating point values
-
-
Method Details
-
getPoint
Get the location of the hyperplane as a point.- Returns:
- the hyperplane location as a point
- See Also:
-
getAzimuth
public double getAzimuth()Get the location of the hyperplane as a single value. This is equivalent tocutAngle.getPoint().getAzimuth()
.- Returns:
- the location of the hyperplane as a single value.
- See Also:
-
getNormalizedAzimuth
public double getNormalizedAzimuth()Get the location of the hyperplane as a single value, normalized to the range[0, 2pi)
. This is equivalent tocutAngle.getPoint().getNormalizedAzimuth()
.- Returns:
- the location of the hyperplane, normalized to the range
[0, 2pi)
- See Also:
-
isPositiveFacing
public boolean isPositiveFacing()Return true if the hyperplane is oriented with its plus side pointing toward increasing angles.- Returns:
- true if the hyperplane is facing in the direction of increasing angles
-
eq
public boolean eq(CutAngle other, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return true if this instance should be considered equivalent to the argument, using the given precision context for comparison.The instances are considered equivalent if they
- have equivalent point locations (points separated by multiples of 2pi are considered equivalent) and
- point in the same direction.
- Parameters:
other
- point to compare withprecision
- precision context to use for the comparison- Returns:
- true if this instance should be considered equivalent to the argument
- See Also:
-
offset
Get the offset (oriented distance) of a point with respect to this instance. Points with an offset of zero lie on the hyperplane itself.- Parameters:
pt
- the point to compute the offset for- Returns:
- the offset of the point
-
classify
Classify a point with respect to this hyperplane.- Specified by:
classify
in interfaceHyperplane<Point1S>
- Overrides:
classify
in classAbstractHyperplane<Point1S>
- Parameters:
pt
- the point to classify- Returns:
- the relative location of the point with respect to this instance
-
project
Project a point onto this instance.- Parameters:
pt
- the point to project- Returns:
- the projection of the point onto this instance. The returned point lies on the hyperplane.
-
reverse
Return a hyperplane that has the opposite orientation as this instance. That is, the plus side of this instance is the minus side of the returned instance and vice versa.- Returns:
- a hyperplane with the opposite orientation
-
transform
Transform this instance using the givenTransform
.- Parameters:
transform
- object to transform this instance with- Returns:
- a new, transformed hyperplane
-
similarOrientation
Return true if this instance has a similar orientation to the given hyperplane, meaning that they point in generally the same direction. This method is not used to determine exact equality of hyperplanes, but rather to determine whether two hyperplanes that contain the same points are parallel (point in the same direction) or anti-parallel (point in opposite directions).- Parameters:
other
- the hyperplane to compare with- Returns:
- true if the hyperplanes point in generally the same direction and could possibly be parallel
-
span
Return aHyperplaneConvexSubset
spanning this entire hyperplane. The returned subset contains all points lying in this hyperplane and no more.Since there are no subspaces in spherical 1D space, this method effectively returns a stub implementation of
HyperplaneConvexSubset
, the main purpose of which is to support the proper functioning of the partitioning code.- Returns:
- a
HyperplaneConvexSubset
containing all points lying in this hyperplane
-
hashCode
public int hashCode() -
equals
-
toString
-