/// <summary> /// Creates a new instance of <see cref="ChunkBetweenIntersections"/> with values for its public fields. /// </summary> /// <param name="extrudedPoints">The extruded points that lie in between the intersection endpoints, defining the line segments of the chunk.</param> /// <param name="startIntersection">The intersection point serving as the start point of the chunk.</param> /// <param name="endIntersection">The extruded points that lie in between the intersection endpoints, defining the line segments of the chunk.</param> public ChunkBetweenIntersections(List <ExtrudedPointUV> extrudedPoints, IntersectionPoint startIntersection, IntersectionPoint endIntersection) { SegmentwiseExtrudedPointList = new SegmentwiseExtrudedPointListUV(extrudedPoints); ExtrudedPoints = extrudedPoints; StartIntersection = startIntersection; EndIntersection = endIntersection; }
/// <summary> /// Determine the closest point on a segmentwise-defined line to a test point /// </summary> /// <param name="point">The test point</param> /// <param name="linePointList">List of points defining the line</param> /// <param name="extrusionAmountAbs">Absolute value of the extrusion distance</param> /// <param name="closestSegmentDifference">Start-to-end vector of the segment containing the closest point</param> /// <param name="closestSegmentIndex">Index of the closest segment.</param> internal static Vector2WithUV ClosestPointAlongSegmentwiseLine(Vector2 point, SegmentwiseExtrudedPointListUV linePointList, float extrusionAmountAbs, out Vector2 closestSegmentDifference, out int closestSegmentIndex) { float fractionAlongClosestSegment; var closestExtrudedPoint = ClosestPointAlongSegmentwiseLine(point, linePointList, extrusionAmountAbs, GetVector, GetAverage, out fractionAlongClosestSegment, out closestSegmentDifference, out closestSegmentIndex); return(new Vector2WithUV(closestExtrudedPoint)); }