Class OrientedPoint
java.lang.Object
org.apache.commons.geometry.core.partitioning.AbstractHyperplane<Vector1D>
org.apache.commons.geometry.euclidean.oned.OrientedPoint
- All Implemented Interfaces:
Hyperplane<Vector1D>
This class represents a 1D oriented hyperplane.
A hyperplane in 1D is a simple point, its orientation being a boolean indicating if the direction is positive or negative.
Instances of this class are guaranteed to be immutable.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionclassify(double location) Classify the number line location with respect to the instance.Classify a point with respect to this hyperplane.booleaneq(OrientedPoint 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.booleanGet the direction of the hyperplane's plus side.doubleGet the location of the hyperplane as a single value.getPoint()Get the location of the hyperplane as a point.inthashCode()booleanReturn true if the hyperplane is oriented with its plus side in the direction of positive infinity.doubleoffset(double location) Compute the offset of the given number line location.doubleGet 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.booleansimilarOrientation(Hyperplane<Vector1D> 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 aHyperplaneConvexSubsetspanning this entire hyperplane.toString()Transform this instance using the givenTransform.Methods inherited from class AbstractHyperplane
contains, getPrecision
-
Method Details
-
getPoint
-
getLocation
Get the location of the hyperplane as a single value. This is equivalent topt.getPoint().getX().- Returns:
- the location of the hyperplane as a single value.
- See Also:
-
getDirection
Get the direction of the hyperplane's plus side.- Returns:
- the hyperplane direction
-
isPositiveFacing
Return true if the hyperplane is oriented with its plus side in the direction of positive infinity.- Returns:
- true if the hyperplane is facing toward positive infinity
-
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
-
offset
-
offset
Compute the offset of the given number line location. This is a convenience overload ofoffset(Vector1D)for use in one dimension.- Parameters:
location- the number line location to compute the offset for- Returns:
- the offset of the location from the instance
-
classify
Classify a point with respect to this hyperplane.- Specified by:
classifyin interfaceHyperplane<Vector1D>- Overrides:
classifyin classAbstractHyperplane<Vector1D>- Parameters:
pt- the point to classify- Returns:
- the relative location of the point with respect to this instance
-
classify
Classify the number line location with respect to the instance. This is a convenience overload ofclassify(Vector1D)for use in one dimension.- Parameters:
location- the number line location to classify- Returns:
- the classification of the number line location with respect to this instance
-
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
-
project
-
span
Return aHyperplaneConvexSubsetspanning this entire hyperplane. The returned subset contains all points lying in this hyperplane and no more.Since there are no subspaces in 1D, 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
HyperplaneConvexSubsetcontaining all points lying in this hyperplane
-
eq
public boolean eq(OrientedPoint 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.Instances are considered equivalent if they
- have equivalent locations and
- point in the same direction.
- Parameters:
other- the 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:
-
hashCode
-
equals
-
toString
-