/// <summary> /// Regenerates a single segment of the curvature given the transform data. /// </summary> /// <param name="curveIndex">The index of the left hand node.</param> public void RegenerateCurve(int curveIndex) { Polynomial2D[] ranges = curve.ranges; ranges[curveIndex] = Generate(curveIndex); curve = new PolynomialCurve2D(ranges); #if DEBUG if (showPreview) { rasterizedPath = curve.Rasterize(previewDetail); } #endif }
public void OnValidate() { // Prevent non-negative or zero precision. previewDetail.Clamp(0.1f, 5f); // Regenerate the curve and rasterized path // so that it can be displayed in the editor window. if (nodes != null && nodes.Length > 1) { RegenerateCurve(); rasterizedPath = curve.Rasterize(previewDetail); } }
/// <summary> /// Regenerates multiple segments of the curvature given the transform data. /// </summary> /// <param name="curveIndices">The indices of the left hand nodes.</param> public void RegenerateCurve(int[] curveIndices) { Polynomial2D[] ranges = curve.ranges; foreach (int index in curveIndices) { ranges[index] = Generate(index); } curve = new PolynomialCurve2D(ranges); #if DEBUG if (showPreview) { rasterizedPath = curve.Rasterize(previewDetail); } #endif }
/// <summary> /// Regenerates the entire curvature with the current transform data. /// </summary> public void RegenerateCurve() { Polynomial2D[] ranges = new Polynomial2D[nodes.Length - 1]; for (int i = 0; i < nodes.Length - 1; i++) { ranges[i] = Generate(i); } curve = new PolynomialCurve2D(ranges); #if DEBUG if (showPreview) { rasterizedPath = curve.Rasterize(previewDetail); } #endif }