/// <summary> /// Projects the point onto the line segment /// </summary> /// <param name="projectedX">Normalized position of the projected point on the line 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 ClosestPointOnSegment(Vector3 point, Segment3 segment, out float projectedX) { return(ClosestPointOnSegment(point, segment.a, segment.b, out projectedX)); }
/// <summary> /// Returns a random point on a segment /// </summary> public static Vector3 PointOnSegment(Segment3 segment) { return(PointOnSegment(segment.a, segment.b)); }
/// <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> /// Returns a distance to the closest point on the line segment /// </summary> public static float DistanceToSegment(Vector3 point, Segment3 segment) { return(Vector3.Distance(point, ClosestPointOnSegment(point, segment))); }
/// <summary> /// Draws a segment /// </summary> public static void Segment3(DebugDrawLine drawLine, Segment3 segment, Color color, float duration, bool depthTest) { drawLine(segment.a, segment.b, color, duration, depthTest); }
/// <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> /// Draws a segment /// </summary> public static void DrawSegment3(Segment3 segment, Color color, float duration = 0, bool depthTest = true) { Draw.Segment3(drawLine, segment, color, duration, depthTest); }
/// <summary> /// Draws a segment /// </summary> public static void DrawSegment3(Segment3 segment) { Draw.Segment3(drawLine, segment); }
/// <summary> /// Draws a segment /// </summary> public static void DrawSegment3(Segment3 segment) { DrawLine(segment.a, segment.b, Color.white); }
/// <summary> /// Draws a segment /// </summary> public static void DrawSegment3(Segment3 segment) { DrawSegment3(segment, white); }
/// <summary> /// Draws a segment /// </summary> public static void Segment3(Segment3 segment, Action <Vector3, Vector3> drawLine) { Line(segment.a, segment.b, drawLine); }
/// <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> /// Draws a segment /// </summary> public static void DrawSegment3(Segment3 segment) { DrawLine(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)); }
/// <summary> /// Draws a segment /// </summary> public static void Segment3(Action <Vector3, Vector3> drawLine, Segment3 segment) { drawLine(segment.a, segment.b); }
/// <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> /// Returns a distance to the closest point on the line segment /// </summary> public static float PointSegment(Vector3 point, Segment3 segment) { return(Vector3.Distance(point, Geometry.ClosestPointOnSegment(point, segment))); }