Ejemplo n.º 1
0
 /// <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);
Ejemplo n.º 2
0
 /// <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);
Ejemplo n.º 3
0
 /// <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);
Ejemplo n.º 4
0
 /// <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);
Ejemplo n.º 5
0
 /// <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);
Ejemplo n.º 6
0
        // 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);
Ejemplo n.º 7
0
 /// <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));
Ejemplo n.º 8
0
 /// <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);