Class LineSubset

java.lang.Object
org.apache.commons.geometry.euclidean.twod.LineSubset
All Implemented Interfaces:
Embedding<Vector2D,Vector1D>, HyperplaneSubset<Vector2D>, Splittable<Vector2D,HyperplaneSubset<Vector2D>>, RegionEmbedding<Vector2D,Vector1D>, Sized
Direct Known Subclasses:
EmbeddedTreeLineSubset, LineConvexSubset

public abstract class LineSubset extends Object implements HyperplaneSubset<Vector2D>, RegionEmbedding<Vector2D,Vector1D>
Class representing a subset of points on a line in 2D Euclidean space. For example, line segments and rays are line subsets. Line subsets may be finite or infinite.
  • Field Details

    • line

      private final Line line
      The line containing this instance.
  • Constructor Details

    • LineSubset

      LineSubset(Line line)
      Construct a new instance based on the given line.
      Parameters:
      line - line forming the base of the instance
  • Method Details

    • getLine

      public Line getLine()
      Get the line containing this subset. This method is an alias for getHyperplane().
      Returns:
      the line containing this subset
      See Also:
    • getHyperplane

      public Line getHyperplane()
      Get the hyperplane containing this instance.
      Specified by:
      getHyperplane in interface HyperplaneSubset<Vector2D>
      Returns:
      the hyperplane containing this instance
    • toSubspace

      public Vector1D toSubspace(Vector2D pt)
      Transform a space point into a subspace point.
      Specified by:
      toSubspace in interface Embedding<Vector2D,Vector1D>
      Parameters:
      pt - n-dimension point of the space
      Returns:
      lower-dimension point of the subspace corresponding to the specified space point
      See Also:
    • getBounds

      public abstract Bounds2D getBounds()
      Get a Bounds2D object defining an axis-aligned bounding box containing all vertices for this subset. Null is returned if the subset is infinite or does not contain any vertices.
      Returns:
      the bounding box for this instance or null if no valid bounds could be determined
    • getSubspaceRegion

      public abstract HyperplaneBoundedRegion<Vector1D> getSubspaceRegion()
      Get the embedded subspace region.
      Specified by:
      getSubspaceRegion in interface RegionEmbedding<Vector2D,Vector1D>
      Returns:
      the embedded subspace region
    • toSpace

      public Vector2D toSpace(Vector1D pt)
      Transform a subspace point into a space point.
      Specified by:
      toSpace in interface Embedding<Vector2D,Vector1D>
      Parameters:
      pt - lower-dimension point of the subspace
      Returns:
      n-dimension point of the space corresponding to the specified subspace point
      See Also:
    • toConvex

      public abstract List<LineConvexSubset> toConvex()
      Convert this instance into a list of convex child subsets representing the same region. Implementations are not required to return an optimal convex subdivision of the current instance. They are free to return whatever subdivision is readily available.
      Specified by:
      toConvex in interface HyperplaneSubset<Vector2D>
      Returns:
      a list of hyperplane convex subsets representing the same subspace region as this instance
    • classify

      public RegionLocation classify(Vector2D pt)
      Classify a point with respect to the subset region. The point is classified as follows:
      • INSIDE - The point lies on the hyperplane and inside of the subset region.
      • BOUNDARY - The point lies on the hyperplane and is on the boundary of the subset region.
      • OUTSIDE - The point does not lie on the hyperplane or it does lie on the hyperplane but is outside of the subset region.
      Specified by:
      classify in interface HyperplaneSubset<Vector2D>
      Parameters:
      pt - the point to classify
      Returns:
      classification of the point with respect to the hyperplane and subspace region
    • intersection

      public Vector2D intersection(Line inputLine)
      Get the unique intersection of this subset with the given line. Null is returned if no unique intersection point exists (ie, the lines are parallel or coincident) or the line does not intersect this instance.
      Parameters:
      inputLine - line to intersect with this line subset
      Returns:
      the unique intersection point between the line and this line subset or null if no such point exists.
      See Also:
    • intersection

      public Vector2D intersection(LineSubset subset)
      Get the unique intersection of this instance with the given line subset. Null is returned if the lines containing the line subsets do not have a unique intersection point (ie, they are parallel or coincident) or the intersection point is unique but is not contained in both line subsets.
      Parameters:
      subset - line subset to intersect with
      Returns:
      the unique intersection point between this line subset and the argument or null if no such point exists.
      See Also:
    • getPrecision

      public org.apache.commons.numbers.core.Precision.DoubleEquivalence getPrecision()
      Return the object used to perform floating point comparisons, which is the same object used by the underlying Line).
      Returns:
      precision object used to perform floating point comparisons.
    • classifyAbscissa

      abstract RegionLocation classifyAbscissa(double abscissa)
      Classify the given line abscissa value with respect to the subspace region.
      Parameters:
      abscissa - the abscissa value to classify
      Returns:
      the region location of the line abscissa value
    • getNonIntersectingSplitResult

      <T extends LineSubset> Split<T> getNonIntersectingSplitResult(Line splitter, T subset)
      Get a split result for cases where no intersection exists between the splitting line and the line underlying the given line subset. This occurs when the two lines are parallel or coincident.
      Type Parameters:
      T - Line subset type
      Parameters:
      splitter - splitting line
      subset - line subset instance being split
      Returns:
      return result of the non-intersecting split operation
    • splitterPlusIsPositiveFacing

      boolean splitterPlusIsPositiveFacing(Line splitterLine)
      Return true if the plus side of the given splitter line is facing in the positive direction of this line.
      Parameters:
      splitterLine - line splitting this instance
      Returns:
      true if the plus side of the given line is facing in the positive direction of this line
    • createSplitResult

      <T extends LineSubset> Split<T> createSplitResult(Line splitter, T low, T high)
      Create a split result for the given splitter line, given the low and high split portion of this instance. The arguments are assigned to the split result's minus and plus properties based on the relative orientation of the splitter line.
      Type Parameters:
      T - Line subset type
      Parameters:
      splitter - splitter line
      low - portion of the split result closest to negative infinity on this line
      high - portion of th split result closest to positive infinity on this line
      Returns:
      a split result for the given splitter line.