Example #1
0
 /// <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));
 }
Example #3
0
 /// <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);
 }
Example #4
0
 /// <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)));
 }
Example #5
0
 /// <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);
 }
Example #6
0
 /// <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));
 }
Example #7
0
 /// <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);
 }
Example #8
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void DrawSegment3(Segment3 segment)
 {
     Draw.Segment3(drawLine, segment);
 }
Example #9
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void DrawSegment3(Segment3 segment)
 {
     DrawLine(segment.a, segment.b, Color.white);
 }
Example #10
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void DrawSegment3(Segment3 segment)
 {
     DrawSegment3(segment, white);
 }
Example #11
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void Segment3(Segment3 segment, Action <Vector3, Vector3> drawLine)
 {
     Line(segment.a, segment.b, drawLine);
 }
Example #12
0
 /// <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));
 }
Example #13
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void DrawSegment3(Segment3 segment)
 {
     DrawLine(segment.a, segment.b);
 }
Example #14
0
 /// <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));
 }
Example #15
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void Segment3(Action <Vector3, Vector3> drawLine, Segment3 segment)
 {
     drawLine(segment.a, segment.b);
 }
Example #16
0
 /// <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));
 }
Example #17
0
 /// <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)));
 }