Class ReverseRay

All Implemented Interfaces:
Embedding<Vector2D,Vector1D>, HyperplaneConvexSubset<Vector2D>, HyperplaneSubset<Vector2D>, Splittable<Vector2D,HyperplaneSubset<Vector2D>>, RegionEmbedding<Vector2D,Vector1D>, Sized

public final class ReverseRay extends LineConvexSubset
Class representing a portion of a line in 2D Euclidean space that starts at infinity and continues in the direction of the line up to a single end point. This is equivalent to taking a Ray and reversing the line direction.

Instances of this class are guaranteed to be immutable.

See Also:
  • Field Details

    • endPoint

      private final Vector2D endPoint
      The end point of the reverse ray.
  • Constructor Details

    • ReverseRay

      ReverseRay(Line line, Vector2D endPoint)
      Construct a new instance from the given line and end point. Callers are responsible for ensuring that the given end point lies on the line. No validation is performed.
      Parameters:
      line - line for the instance
      endPoint - end point for the instance
  • Method Details

    • isFull

      public boolean isFull()
      Return true if this instance contains all points in the hyperplane.

      This method always returns false.

      Returns:
      true if this instance contains all points in the hyperplane
    • isInfinite

      public boolean isInfinite()
      Return true if the size of the instance is infinite.

      This method always returns true.

      Returns:
      true if the size of the instance is infinite
    • isFinite

      public boolean isFinite()
      Return true if the size of the instance is finite.

      This method always returns false.

      Returns:
      true if the size of the instance is finite
    • getSize

      public double getSize()
      Get the size of the instance.

      This method always returns Double.POSITIVE_INFINITY.

      Returns:
      the size of the instance
    • getCentroid

      public Vector2D getCentroid()
      Get the centroid, or geometric center, of the hyperplane subset or null if no centroid exists or one exists but is not unique. A centroid will not exist for empty or infinite subsets.

      The centroid of a geometric object is defined as the mean position of all points in the object, including interior points, vertices, and other points lying on the boundary. If a physical object has a uniform density, then its center of mass is the same as its geometric centroid.

      This method always returns null.

      Returns:
      the centroid of the hyperplane subset or null if no unique centroid exists
      See Also:
    • getStartPoint

      public Vector2D getStartPoint()
      Get the start point for the subset.

      This method always returns null.

      Specified by:
      getStartPoint in class LineConvexSubset
      Returns:
      the start point for the subset, or null if no start point exists
    • getSubspaceStart

      public double getSubspaceStart()
      Get the 1D start location of the subset or Double.NEGATIVE_INFINITY if no start location exists.

      This method always returns Double.NEGATIVE_INFINITY.

      Specified by:
      getSubspaceStart in class LineConvexSubset
      Returns:
      the 1D start location of the subset or Double.NEGATIVE_INFINITY if no start location exists.
    • getEndPoint

      public Vector2D getEndPoint()
      Get the end point for the subset.
      Specified by:
      getEndPoint in class LineConvexSubset
      Returns:
      the end point for the subset, or null if no end point exists.
    • getSubspaceEnd

      public double getSubspaceEnd()
      Get the 1D end location of the subset or Double.POSITIVE_INFINITY if no end location exists.
      Specified by:
      getSubspaceEnd in class LineConvexSubset
      Returns:
      the 1D end location of the subset or Double.POSITIVE_INFINITY if no end location exists
    • getBounds

      public 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.

      This method always returns null.

      Specified by:
      getBounds in class LineSubset
      Returns:
      the bounding box for this instance or null if no valid bounds could be determined
    • transform

      public ReverseRay transform(Transform<Vector2D> transform)
      Return a new hyperplane subset resulting from the application of the given transform. The current instance is not modified.

      Hyperplane convex subsets subjected to affine transformations remain convex.

      Specified by:
      transform in interface HyperplaneConvexSubset<Vector2D>
      Specified by:
      transform in interface HyperplaneSubset<Vector2D>
      Specified by:
      transform in class LineConvexSubset
      Parameters:
      transform - the transform instance to apply
      Returns:
      new transformed hyperplane subset
    • reverse

      public Ray reverse()
      Reverse the orientation of the hyperplane for this instance, returning the result as a new instance. The returned subset contains the same points but has a reversed orientation.
      Specified by:
      reverse in interface HyperplaneConvexSubset<Vector2D>
      Specified by:
      reverse in class LineConvexSubset
      Returns:
      a hyperplane convex subset representing the same region but with the opposite orientation.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • classifyAbscissa

      RegionLocation classifyAbscissa(double abscissa)
      Classify the given line abscissa value with respect to the subspace region.
      Specified by:
      classifyAbscissa in class LineSubset
      Parameters:
      abscissa - the abscissa value to classify
      Returns:
      the region location of the line abscissa value
    • closestAbscissa

      double closestAbscissa(double abscissa)
      Get the closest value in the subspace region to the given abscissa.
      Specified by:
      closestAbscissa in class LineConvexSubset
      Parameters:
      abscissa - input abscissa
      Returns:
      the closest value in the subspace region to the given abscissa
    • splitOnIntersection

      protected Split<LineConvexSubset> splitOnIntersection(Line splitter, Vector2D intersection)
      Split this instance using the given splitter line and intersection point.
      Specified by:
      splitOnIntersection in class LineConvexSubset
      Parameters:
      splitter - splitter line
      intersection - intersection point between the splitter line and the line for this instance
      Returns:
      the result of splitting this instance with the given splitter line and intersection point