/// <summary>Returns the t-values of a linear 2D type (Ray2D, Line2D or LineSegment2D) where it would intersect a 2D circle, if at all</summary> /// <param name="linear">The Ray, Line or LineSegment to test intersection with</param> /// <param name="circle">The circle to test intersection with</param> public static ResultsMax2 <float> LinearCircleTValues <T>(T linear, Circle2D circle) where T : ILinear2D { ResultsMax2 <float> values = IntersectionTest.LinearCircleTValues(linear.Origin, linear.Dir, circle.center, circle.radius); if (values.count == 0) { return(default);
/// <summary>Returns the t-value of each linear 2D type (Ray2D, Line2D or LineSegment2D) where they intersect, if at all</summary> /// <param name="a">The first Ray, Line or LineSegment</param> /// <param name="b">The second Ray, Line or LineSegment</param> /// <param name="tA">The t-value of the intersection of the first linear type</param> /// <param name="tB">The t-value of the intersection of the second linear type</param> [MethodImpl(INLINE)] public static bool LinearTValues <T, U>(T a, U b, out float tA, out float tB) where T : ILinear2D where U : ILinear2D { return(IntersectionTest.LinearTValues(a.Origin, a.Dir, b.Origin, b.Dir, out tA, out tB) && a.IsValidTValue(tA) && b.IsValidTValue(tB)); }
/// <summary>Returns the intersections this line has with a circle (if any)</summary> /// <param name="linear">The linear object to test intersection with (Ray2D, Line2D or LineSegment2D)</param> /// <param name="circle">The circle to test intersection against</param> [MethodImpl(INLINE)] public static ResultsMax2 <Vector2> Intersect <T>(this T linear, Circle2D circle) where T : ILinear2D => IntersectionTest.LinearCircleIntersectionPoints(linear, circle);
/// <summary>Returns whether or not this line intersects another linear object (Ray2D, Line2D or LineSegment2D), and returns the point (if any)</summary> /// <param name="linear">The linear object to test intersection with (Ray2D, Line2D or LineSegment2D)</param> /// <param name="other">The other linear object to test intersection against (Ray2D, Line2D or LineSegment2D)</param> /// <param name="intersectionPoint">The point at which they intersect</param> [MethodImpl(INLINE)] public static bool Intersect <T, U>(this T linear, U other, out Vector2 intersectionPoint) where T : ILinear2D where U : ILinear2D => IntersectionTest.LinearIntersectionPoint(linear, other, out intersectionPoint);
/// <summary>Returns whether or not this line intersects a circle</summary> /// <param name="linear">The linear object to test intersection with (Ray2D, Line2D or LineSegment2D)</param> /// <param name="circle">The circle to test intersection against</param> [MethodImpl(INLINE)] public static bool Intersects <T>(this T linear, Circle2D circle) where T : ILinear2D => IntersectionTest.LinearCircleIntersects(linear, circle);
/// <summary>Returns whether or not this intersects another linear object (Ray2D, Line2D or LineSegment2D)</summary> /// <param name="linear">The linear object to test intersection with (Ray2D, Line2D or LineSegment2D)</param> /// <param name="other">The other linear object to test intersection against (Ray2D, Line2D or LineSegment2D)</param> [MethodImpl(INLINE)] public static bool Intersects <T, U>(this T linear, U other) where T : ILinear2D where U : ILinear2D => IntersectionTest.Linear(linear, other);