/// <summary>Returns the intersection point of a ray and an infinite line (if there is one)</summary> /// <param name="intersectionPoint">The point at which they intersect</param> public static bool RayLine(Ray2D ray, Line2D line, out Vector2 intersectionPoint) => RayLine(ray.origin, ray.dir, line.origin, line.dir, out intersectionPoint);
/// <summary>Returns the intersection point of a ray and a line segment (if there is one)</summary> /// <param name="intersectionPoint">The point at which they intersect</param> public static bool RayLineSegment(Ray2D ray, LineSegment2D lineSegment, out Vector2 intersectionPoint) => RayLineSegment(ray.origin, ray.dir, lineSegment.start, lineSegment.end, out intersectionPoint);
/// <summary>Returns whether or not a ray and a line intersect</summary> public static bool RayLine(Ray2D ray, Line2D line) => RayLine(ray.origin, ray.dir, line.origin, line.dir);
/// <summary>Returns whether or not a ray and a line segment intersect</summary> public static bool RayLineSegment(Ray2D ray, LineSegment2D lineSegment) => RayLineSegment(ray.origin, ray.dir, lineSegment.start, lineSegment.end);
/// <summary>Returns the intersection point of two rays (if there is one)</summary> /// <param name="intersectionPoint">The point at which they intersect</param> public static bool Rays(Ray2D a, Ray2D b, out Vector2 intersectionPoint) => Rays(a.origin, a.dir, b.origin, b.dir, out intersectionPoint);
// Naming order: Ray, LineSegment, Line, Circle #region Rays /// <summary>Returns whether or not two rays intersect</summary> public static bool Rays(Ray2D a, Ray2D b) => GetLineLineTValues(b.origin - a.origin, a.dir, b.dir, out float tA, out float tB) && BoundsTestRay(tA) && BoundsTestRay(tB);
/// <summary>Returns the number of intersection points between ray and a circle</summary> public static int RayCircle(Ray2D ray, Circle circle) => GetLineCircleIntersectionCountFiltered(ray.origin, ray.dir, circle.center, circle.radius, t => BoundsTestRay(t));
/// <summary>Returns the number of intersections and the points at which a ray and a circle intersect (if they exist)</summary> public static int RayCircle(Ray2D ray, Circle circle, out Vector2 intsctPtA, out Vector2 intsctPtB) => GetLineCircleIntersectionPointsFiltered(ray.origin, ray.dir, circle.center, circle.radius, t => BoundsTestRay(t), out intsctPtA, out intsctPtB);