/// <summary> /// Returns a distance to the closest point on the segment /// </summary> public static float PointSegment(Vector3 point, Segment3 segment) { return(Vector3.Distance(point, Closest.PointSegment(point, segment))); }
/// <summary> /// Returns the distance between the closest points on the segment and the sphere /// </summary> public static float SegmentSphere(Segment3 segment, Sphere sphere) { return(SegmentSphere(segment.a, segment.b, sphere.center, sphere.radius)); }
/// <summary> /// Finds closest points on the segment and the sphere /// </summary> public static void SegmentSphere(Segment3 segment, Sphere sphere, out Vector3 segmentPoint, out Vector3 spherePoint) { SegmentSphere(segment.a, segment.b, sphere.center, sphere.radius, out segmentPoint, out spherePoint); }
/// <summary> /// Projects the point onto the segment /// </summary> /// <param name="projectedX">Normalized position of the projected point on the segment. /// Value of zero means that the projected point coincides with segment.a. /// Value of one means that the projected point coincides with segment.b.</param> public static Vector3 PointSegment(Vector3 point, Segment3 segment, out float projectedX) { return(PointSegment(point, segment.a, segment.b, out projectedX)); }
/// <summary> /// Tests if the point lies on the segment /// </summary> public static bool PointSegment(Vector3 point, Segment3 segment) { return(PointSegment(point, segment.a, segment.b)); }
/// <summary> /// Computes an intersection of the segment and the sphere /// </summary> public static bool SegmentSphere(Segment3 segment, Sphere sphere, out IntersectionSegmentSphere intersection) { return(SegmentSphere(segment.a, segment.b, sphere.center, sphere.radius, out intersection)); }