/// <summary> /// Return <see cref="LineExtrusionResults"/> containing contiguous lines of extruded points. /// </summary> /// <param name="originalLine">The line points to be extruded.</param> /// <param name="lineExtrusionConfiguration">The extrusion configuration.</param> public static LineExtrusionResults ExtrudeSegmentedLineBothDirections(ILineSegmentation originalLine, LineExtrusionConfiguration lineExtrusionConfiguration) { var originalLinePointsUV = LineSegmentation.GetLinePointsUV(originalLine); LineExtrusionResults results; if (originalLinePointsUV.Count >= 2) { var extrudedSubspaceTotal = SegmentedLineExtrusionFromSegments.GetExtrudedSubspaceAllSides(originalLinePointsUV, lineExtrusionConfiguration.ExtrusionAmount); results = GetExtrudedLines(originalLinePointsUV, extrudedSubspaceTotal, lineExtrusionConfiguration); } else { results = LineExtrusionResults.Empty; } return(results); }
/// <summary> /// Segments an <see cref="ILineSegmentation"/> line into a list of <see cref="LinePointUV"/> with uv parameters. /// </summary> public static List <LinePointUV> GetLinePointsUV(ILineSegmentation segemtaneome) { List <LinePointUV> ret = new List <LinePointUV>(); var points = segemtaneome.GetLineSegmentsPoints(); if (points.Count == 0) { return(ret); } float v = 0.5f; float distance = 0f; var previousVector = points[0].Point; for (int i = 0; i < points.Count; i++) { var currentPoint = points[i]; distance += (currentPoint.Point - previousVector).magnitude; ret.Add(new LinePointUV(currentPoint.Parameter, currentPoint.Point, new Vector2(distance, v))); previousVector = currentPoint.Point; } return(ret); }