示例#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));
 }
示例#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);
 }
示例#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)));
 }
示例#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);
 }
示例#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));
 }
示例#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);
 }
示例#8
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void DrawSegment3(Segment3 segment)
 {
     Draw.Segment3(drawLine, segment);
 }
示例#9
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void DrawSegment3(Segment3 segment)
 {
     DrawLine(segment.a, segment.b, Color.white);
 }
示例#10
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void DrawSegment3(Segment3 segment)
 {
     DrawSegment3(segment, white);
 }
示例#11
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void Segment3(Segment3 segment, Action <Vector3, Vector3> drawLine)
 {
     Line(segment.a, segment.b, drawLine);
 }
示例#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));
 }
示例#13
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void DrawSegment3(Segment3 segment)
 {
     DrawLine(segment.a, segment.b);
 }
示例#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));
 }
示例#15
0
 /// <summary>
 /// Draws a segment
 /// </summary>
 public static void Segment3(Action <Vector3, Vector3> drawLine, Segment3 segment)
 {
     drawLine(segment.a, segment.b);
 }
示例#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));
 }
示例#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)));
 }