Class LinecastPoint2D
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.AbstractLinecastPoint<Vector2D,Vector2D.Unit,Line>
-
- org.apache.commons.geometry.euclidean.twod.LinecastPoint2D
-
public class LinecastPoint2D extends AbstractLinecastPoint<Vector2D,Vector2D.Unit,Line>
Class representing intersections resulting from linecast operations in Euclidean 2D space. This class contains the intersection point along with the boundary normal of the target at the point of intersection.- See Also:
Linecastable2D
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<LinecastPoint2D>
ABSCISSA_ORDER
Comparator that sorts intersection instances by increasing abscissa order.
-
Constructor Summary
Constructors Constructor Description LinecastPoint2D(Vector2D point, Vector2D normal, Line line)
Construct a new instance from its components.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static boolean
containsEq(LinecastPoint2D pt, java.util.List<? extends LinecastPoint2D> list)
Return true if the given linecast point is equivalent to any of those in the given list.boolean
eq(LinecastPoint2D 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.static void
sortAndFilter(java.util.List<LinecastPoint2D> pts)
Sort the given list of linecast points by increasing abscissa value and filter to remove duplicate entries (as determined by theeq(LinecastPoint2D, Precision.DoubleEquivalence)
method).-
Methods inherited from class org.apache.commons.geometry.euclidean.AbstractLinecastPoint
equals, getAbscissa, getLine, getNormal, getPoint, hashCode, toString
-
-
-
-
Field Detail
-
ABSCISSA_ORDER
public static final java.util.Comparator<LinecastPoint2D> ABSCISSA_ORDER
Comparator that sorts intersection instances by increasing abscissa order. If two abscissa values are equal, the comparison usesVector2D.COORDINATE_ASCENDING_ORDER
with the intersection normals.
-
-
Method Detail
-
eq
public boolean eq(LinecastPoint2D 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 points, normals, and lines.- 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
-
sortAndFilter
public static void sortAndFilter(java.util.List<LinecastPoint2D> pts)
Sort the given list of linecast points by increasing abscissa value and filter to remove duplicate entries (as determined by theeq(LinecastPoint2D, Precision.DoubleEquivalence)
method). The argument is modified.- Parameters:
pts
- list of points to sort and filter
-
containsEq
private static boolean containsEq(LinecastPoint2D pt, java.util.List<? extends LinecastPoint2D> list)
Return true if the given linecast point is equivalent to any of those in the given list.- Parameters:
pt
- point to testlist
- list to test against- Returns:
- true if the given linecast point is equivalent to any of those in the given list
-
-