private WW.Cad.Drawing.Polyline2DE method_25( DxfVertex2DCollection points, bool isInterpolated) { bool closed = this.Closed; int count = points.Count; WW.Cad.Drawing.Polyline2DE polyline2De = new WW.Cad.Drawing.Polyline2DE(count, closed); if (count > 0) { DxfVertex2D dxfVertex2D = points[0]; polyline2De.Add(new Point2DE(dxfVertex2D.Position) { IsInterpolatedPoint = isInterpolated }); for (int index = 1; index < count; ++index) { DxfVertex2D point = points[index]; if (!(dxfVertex2D.Position == point.Position)) { polyline2De.Add(new Point2DE(point.Position) { IsInterpolatedPoint = isInterpolated }); dxfVertex2D = point; } } if (closed && count > 1 && polyline2De[0].Position == polyline2De[polyline2De.Count - 1].Position) { polyline2De.RemoveAt(polyline2De.Count - 1); } } return(polyline2De); }
private WW.Cad.Drawing.Polyline2DE method_28(int power, int noOfSplineLineParts) { WW.Cad.Drawing.Polyline2DE polyline2De = new WW.Cad.Drawing.Polyline2DE(); int count = this.dxfVertex2DCollection_0.Count; if (count <= power) { return(this.method_19()); } BSplineD bsplineD = new BSplineD(power, count, this.Closed); double[] result = new double[power + 1]; double maxU = bsplineD.MaxU; int num1 = noOfSplineLineParts + 1; double num2 = maxU / (double)(num1 - 1); int num3 = 0; double u = 0.0; while (num3 < num1) { int knotSpanIndex = bsplineD.GetKnotSpanIndex(u); bsplineD.EvaluateBasisFunctions(knotSpanIndex, u, result); WW.Math.Point2D zero = WW.Math.Point2D.Zero; for (int index = 0; index <= power; ++index) { DxfVertex2D dxfVertex2D = this.dxfVertex2DCollection_0[(knotSpanIndex - power + index) % count]; zero += result[index] * new Vector2D(dxfVertex2D.Position); } Point2DE point2De = new Point2DE(zero) { IsInterpolatedPoint = true }; polyline2De.Add(point2De); ++num3; u += num2; } return(polyline2De); }