void UpdateSampling(SmoothCurveElement c) { if (MinimizeSampling && c.source is Segment2d) { c.polyLine = new PolyLine2d(); c.polyLine.AppendVertex(((Segment2d)c.source).P0); c.polyLine.AppendVertex(((Segment2d)c.source).P1); } else { c.polyLine = new PolyLine2d( CurveSampler2.AutoSample(c.source, DistanceAccuracy, SpacingT)); } }
/// <summary> /// Resample parametric solid into polygonal solid /// </summary> public GeneralPolygon2d Convert(double fSpacingLength, double fSpacingT, double fDeviationTolerance) { GeneralPolygon2d poly = new GeneralPolygon2d(); poly.Outer = new Polygon2d( CurveSampler2.AutoSample(this.outer, fSpacingLength, fSpacingT)); poly.Outer.Simplify(0, fDeviationTolerance); foreach (var hole in this.Holes) { Polygon2d holePoly = new Polygon2d( CurveSampler2.AutoSample(hole, fSpacingLength, fSpacingT)); holePoly.Simplify(0, fDeviationTolerance); poly.AddHole(holePoly, false); } return(poly); }
void UpdateSampling(SmoothLoopElement l) { l.polygon = new Polygon2d( CurveSampler2.AutoSample(l.source, DistanceAccuracy, SpacingT)); }