private static void smethod_12( Polyline4D polyline, ITransformer4D transformation, Point2D p0, Point2D p1, Point2D p2, Point2D p3, double epsilonSquared) { Vector2D dp01 = p1 - p0; Vector2D dp12 = p2 - p1; Vector2D dp23 = p3 - p2; if (ShapeTool.smethod_10(dp01, dp12, dp23, p3 - p0, epsilonSquared)) { polyline.Add(transformation.TransformTo4D(p1)); polyline.Add(transformation.TransformTo4D(p2)); polyline.Add(transformation.TransformTo4D(p3)); } else { Point2D p1_1 = p0 + 0.5 * dp01; Point2D point2D1 = p1 + 0.5 * dp12; Point2D p2_1 = p2 + 0.5 * dp23; Vector2D vector2D1 = point2D1 - p1_1; Vector2D vector2D2 = p2_1 - point2D1; Point2D p2_2 = p1_1 + 0.5 * vector2D1; Point2D p1_2 = point2D1 + 0.5 * vector2D2; Vector2D vector2D3 = p1_2 - p2_2; Point2D point2D2 = p2_2 + 0.5 * vector2D3; ShapeTool.smethod_12(polyline, transformation, p0, p1_1, p2_2, point2D2, epsilonSquared); ShapeTool.smethod_12(polyline, transformation, point2D2, p1_2, p2_1, p3, epsilonSquared); } }
private static void smethod_8( Polyline4D polyline, ITransformer4D transformation, Point2D p0, Point2D p1, Point2D p2, double epsilonSquared) { Vector2D dp02 = p2 - p0; Vector2D dp01 = p1 - p0; Vector2D dp12 = p2 - p1; if (ShapeTool.smethod_9(dp01, dp12, dp02, epsilonSquared)) { polyline.Add(transformation.TransformTo4D(p1)); polyline.Add(transformation.TransformTo4D(p2)); } else { Point2D p1_1 = p0 + 0.5 * dp01; Point2D p1_2 = p1 + 0.5 * dp12; Vector2D vector2D = p1_2 - p1_1; Point2D point2D = p1_1 + 0.5 * vector2D; ShapeTool.smethod_8(polyline, transformation, p0, p1_1, point2D, epsilonSquared); ShapeTool.smethod_8(polyline, transformation, point2D, p1_2, p2, epsilonSquared); } }
public Polyline4D GetReverse() { Polyline4D polyline4D = new Polyline4D(this.Count, this.Closed); for (int index = this.Count - 1; index >= 0; --index) { polyline4D.Add(this[index]); } return(polyline4D); }
public static Polyline4D GetSubPolyline( IList <Vector4D> points, int start, int length) { Polyline4D polyline4D = new Polyline4D(length); int num = start + length; for (int index = start; index < num; ++index) { polyline4D.Add(points[index]); } return(polyline4D); }
public IList <Polyline4D> ToPolylines4D(double shapeFlattenEpsilon) { IList <Polyline4D> polyline4DList = (IList <Polyline4D>) new List <Polyline4D>(this.ilist_0.Count); foreach (Polyline4D polyline4D1 in (IEnumerable <Polyline4D>) this.ilist_0) { Polyline4D polyline4D2 = new Polyline4D(polyline4D1.Count, polyline4D1.Closed); foreach (Vector4D vector4D in (List <Vector4D>)polyline4D1) { polyline4D2.Add(vector4D); } polyline4DList.Add(polyline4D2); } return(polyline4DList); }
public IShape4D GetFlattened(ITransformer4D transformer, double shapeFlattenEpsilon) { IList <Polyline4D> polylines = (IList <Polyline4D>) new List <Polyline4D>(this.ilist_0.Count); for (int index1 = 0; index1 < this.ilist_0.Count; ++index1) { Polyline4D polyline4D1 = this.ilist_0[index1]; Polyline4D polyline4D2 = new Polyline4D(polyline4D1.Count, polyline4D1.Closed); for (int index2 = 0; index2 < polyline4D1.Count; ++index2) { polyline4D2.Add(transformer.Transform(polyline4D1[index2])); } polylines.Add(polyline4D2); } return((IShape4D) new PolylineShape4D(polylines, this.bool_0)); }
public static List <Polyline4D> GetFlattened( ITransformer4D transformation, IShape2D shape, double epsilon) { if (epsilon == 0.0) { epsilon = -0.01; } List <Polyline4D> polyline4DList = new List <Polyline4D>(); if (epsilon < 0.0) { Bounds2D bounds = ShapeTool.GetBounds(shape); if (!bounds.Initialized) { return(polyline4DList); } epsilon *= -System.Math.Max(bounds.Delta.X, bounds.Delta.Y); } epsilon *= epsilon; ISegment2DIterator iterator = shape.CreateIterator(); if (iterator.MoveNext()) { Point2D[] points = new Point2D[3]; Polyline4D polyline = (Polyline4D)null; Point2D p0 = new Point2D(); do { switch (iterator.Current(points, 0)) { case SegmentType.MoveTo: polyline = new Polyline4D(); polyline4DList.Add(polyline); polyline.Add(transformation.TransformTo4D(points[0])); p0 = points[0]; break; case SegmentType.LineTo: polyline.Add(transformation.TransformTo4D(points[0])); p0 = points[0]; break; case SegmentType.QuadTo: ShapeTool.smethod_8(polyline, transformation, p0, points[0], points[1], epsilon); p0 = points[1]; break; case SegmentType.CubicTo: ShapeTool.smethod_12(polyline, transformation, p0, points[0], points[1], points[2], epsilon); p0 = points[2]; break; case SegmentType.Close: polyline.Closed = true; if (polyline.Count > 1 && polyline[polyline.Count - 1] == polyline[0]) { polyline.RemoveAt(polyline.Count - 1); break; } break; } }while (iterator.MoveNext()); } return(polyline4DList); }