Interface Ray2d

All Known Subinterfaces:
MRay2d

public interface Ray2d
Read-only interface to handle 2-dimensional rays.
Since:
9.10.2
  • Method Summary

    Modifier and Type Method Description
    static Ray2d create​(Vector2d origin, Vector2d direction)
    Returns a ray with the given origin and direction.
    static Ray2d create​(Ray2d other)
    Returns a deep copy of the given ray.
    Vector2d getDirection()
    Returns the direction of this ray.
    Vector2d getOrigin()
    Returns the origin of this ray.
    Optional<MVector2d> intersect​(Ray2d ray)
    Returns an optional containing the intersection point between the rays if present, an empty optional otherwise.
    boolean intersects​(AABB2d aabb)
    Returns true if the ray intersects with the bounding rectangle, false otherwise.
    boolean intersects​(Ray2d ray)
    Returns true if the rays intersect, false otherwise.
  • Method Details

    • create

      static Ray2d create​(Ray2d other)
      Returns a deep copy of the given ray.
      Parameters:
      other - the other ray
      Returns:
      a deep copy of the given ray
      Since:
      9.10.2
    • create

      static Ray2d create​(Vector2d origin, Vector2d direction)
      Returns a ray with the given origin and direction.
      Parameters:
      origin - the origin of the ray
      direction - the direction of the ray
      Returns:
      a ray with the given origin and direction
      Since:
      9.10.2
    • getOrigin

      Vector2d getOrigin()
      Returns the origin of this ray.
      Returns:
      the origin of this ray
      Since:
      9.10.2
    • getDirection

      Vector2d getDirection()
      Returns the direction of this ray.
      Returns:
      the direction of this ray
      Since:
      9.10.2
    • intersects

      boolean intersects​(Ray2d ray)
      Returns true if the rays intersect, false otherwise.
      Parameters:
      ray - the ray with which this ray is checked for intersection
      Returns:
      true if the rays intersect, false otherwise
      Since:
      9.10.2
    • intersect

      Optional<MVector2d> intersect​(Ray2d ray)
      Returns an optional containing the intersection point between the rays if present, an empty optional otherwise.
      Parameters:
      ray - the ray with which this ray is checked for intersection
      Returns:
      an optional containing the intersection point between the rays if present, an empty optional otherwise
      Since:
      9.10.2
    • intersects

      boolean intersects​(AABB2d aabb)
      Returns true if the ray intersects with the bounding rectangle, false otherwise.
      Parameters:
      aabb - the axis-aligned bounding rectangle with which this is checked for intersection
      Returns:
      true if the ray intersects with the bounding rectangle, false otherwise
      Since:
      9.10.2