Interface Linecastable2D

All Known Subinterfaces:
BoundarySource2D
All Known Implementing Classes:
BoundaryList2D, BoundarySourceLinecaster2D, Circle, ConvexArea, LinePath, LinePath.SimplifiedLinePath, Parallelogram, RegionBSPTree2D

public interface Linecastable2D
Interface for objects that support linecast operations in Euclidean 2D space.

Linecasting is a process that takes a line or convex line subset and intersects it with the boundaries of a region. This is similar to raycasting used for collision detection with the exception that the intersecting element can be a line or convex line subset and not just a ray.

  • Method Summary

    Modifier and Type
    Method
    Description
    linecast(Line line)
    Intersect the given line against the boundaries in this instance, returning a list of all intersections in order of increasing position along the line.
    Intersect the given line subset against the boundaries in this instance, returning a list of all intersections in order of increasing position along the line.
    Intersect the given line against the boundaries in this instance, returning the first intersection found when traveling in the direction of the line from infinity.
    Intersect the given line subset against the boundaries in this instance, returning the first intersection found when traveling in the direction of the line subset from its start location.
  • Method Details

    • linecast

      default List<LinecastPoint2D> linecast(Line line)
      Intersect the given line against the boundaries in this instance, returning a list of all intersections in order of increasing position along the line. An empty list is returned if no intersections are discovered.
      Parameters:
      line - line the line to intersect
      Returns:
      a list of computed intersections in order of increasing position along the line
    • linecast

      Intersect the given line subset against the boundaries in this instance, returning a list of all intersections in order of increasing position along the line. An empty list is returned if no intersections are discovered.
      Parameters:
      subset - line subset to intersect
      Returns:
      a list of computed intersections in order of increasing position along the line
    • linecastFirst

      default LinecastPoint2D linecastFirst(Line line)
      Intersect the given line against the boundaries in this instance, returning the first intersection found when traveling in the direction of the line from infinity.
      Parameters:
      line - the line to intersect
      Returns:
      the first intersection found or null if no intersection is found
    • linecastFirst

      LinecastPoint2D linecastFirst(LineConvexSubset subset)
      Intersect the given line subset against the boundaries in this instance, returning the first intersection found when traveling in the direction of the line subset from its start location.
      Parameters:
      subset - line subset to intersect
      Returns:
      the first intersection found or null if no intersection is found