private WW.Cad.Drawing.Polyline2D2N method_29(int power, int noOfSplineLineParts) { WW.Cad.Drawing.Polyline2D2N polyline2D2N = new WW.Cad.Drawing.Polyline2D2N(); int count = this.dxfVertex2DCollection_0.Count; if (count <= power) { return(this.method_21()); } 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); double[,] derivatives = new double[2, power + 1]; Point2D2N point2D2N1 = (Point2D2N)null; int num3 = 0; double u = 0.0; while (num3 < num1) { int knotSpanIndex = bsplineD.GetKnotSpanIndex(u); bsplineD.EvaluateBasisFunctions(knotSpanIndex, u, result); WW.Math.Point2D zero1 = WW.Math.Point2D.Zero; for (int index = 0; index <= power; ++index) { DxfVertex2D dxfVertex2D = this.dxfVertex2DCollection_0[(knotSpanIndex - power + index) % count]; zero1 += result[index] * new Vector2D(dxfVertex2D.Position); } bsplineD.GetDerivativesBasisFunctions(knotSpanIndex, u, 1, derivatives); Vector2D zero2 = Vector2D.Zero; for (int index = 0; index <= power; ++index) { zero2 += (Vector2D)this.dxfVertex2DCollection_0[(knotSpanIndex - power + index) % count].Position * derivatives[1, index]; } Vector2D unit = new Vector2D(-zero2.Y, zero2.X).GetUnit(); Point2D2N point2D2N2 = new Point2D2N(zero1) { IsInterpolatedPoint = true }; point2D2N2.StartNormal = unit; if (point2D2N1 != null) { point2D2N1.EndNormal = unit; } polyline2D2N.Add(point2D2N2); point2D2N1 = point2D2N2; ++num3; u += num2; } if (this.Closed) { polyline2D2N[num1 - 1].EndNormal = polyline2D2N[0].StartNormal; } return(polyline2D2N); }
private void method_14( DrawContext context, WW.Cad.Drawing.Surface.Geometry geometry, DxfPolyline2DSpline.Interface43 polylineProvider, bool allWidthsAreZero) { if (allWidthsAreZero) { if (this.Thickness == 0.0) { WW.Cad.Drawing.Polyline2DE wrappee = polylineProvider.imethod_0(); geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2DE(wrappee, this.Transform)); } else { WW.Cad.Drawing.Polyline2D2N wrappee1 = polylineProvider.imethod_1(); if (wrappee1.Count > 0) { geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2D2N(wrappee1, this.Transform)); } else { WW.Cad.Drawing.Polyline2DE wrappee2 = polylineProvider.imethod_0(); geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2DE(wrappee2, this.Transform)); } } } else if (this.Thickness == 0.0) { WW.Cad.Drawing.Polyline2D2WN wrappee1 = polylineProvider.imethod_2(); if (wrappee1.Count > 0) { geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2D2WN(wrappee1, context.Model.Header.FillMode, this.Transform)); } else { WW.Cad.Drawing.Polyline2DE wrappee2 = polylineProvider.imethod_0(); geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2DE(wrappee2, this.Transform)); } } else { WW.Cad.Drawing.Polyline2D2WN wrappee1 = polylineProvider.imethod_2(); if (wrappee1.Count > 0) { geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2D2WN(wrappee1, context.Model.Header.FillMode, this.Transform)); } else { WW.Cad.Drawing.Polyline2DE wrappee2 = polylineProvider.imethod_0(); geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2DE(wrappee2, this.Transform)); } } }
private static void smethod_9( DxfEntity entity, ISurfaceGraphicsFactory graphicsFactory, WW.Cad.Drawing.Polyline2D2N polyline2D, Interface41 transformer, Polyline4D polyline4DBottom, Polyline4D polyline4DTop) { int count = polyline2D.Count; int startVertexIndex = polyline2D.Closed ? count - 1 : 0; for (int endVertexIndex = polyline2D.Closed ? 0 : 1; endVertexIndex < count; ++endVertexIndex) { Point2D2N point2D2N1 = polyline2D[startVertexIndex]; Point2D2N point2D2N2 = point2D2N1; int num1 = endVertexIndex; while (endVertexIndex < count) { Point2D2N point2D2N3 = polyline2D[endVertexIndex]; if (!(point2D2N1.EndNormal != point2D2N3.StartNormal)) { ++endVertexIndex; point2D2N1 = point2D2N3; } else { break; } } if (endVertexIndex == count) { endVertexIndex = count - 1; } Vector3D[] vector3DArray = new Vector3D[endVertexIndex - num1 + 2]; vector3DArray[0] = transformer.Transform((Vector3D)point2D2N2.StartNormal); vector3DArray[1] = transformer.Transform((Vector3D)point2D2N2.EndNormal); int num2 = num1; int index1 = 2; while (num2 < endVertexIndex) { int index2 = num2 >= count ? 0 : num2; vector3DArray[index1] = transformer.Transform((Vector3D)polyline2D[index2].EndNormal); ++num2; ++index1; } graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4DBottom, (IList <Vector4D>)polyline4DTop, (IList <Vector3D>)vector3DArray, startVertexIndex, endVertexIndex); startVertexIndex = endVertexIndex; } }
private WW.Cad.Drawing.Polyline2D2N method_26( DxfVertex2DCollection points, bool isInterpolatedPoint) { bool closed = this.Closed; int count = points.Count; WW.Cad.Drawing.Polyline2D2N polyline2D2N = new WW.Cad.Drawing.Polyline2D2N(count, closed); if (count > 0) { DxfVertex2D dxfVertex2D = points[0]; for (int index = 1; index < count; ++index) { DxfVertex2D point = points[index]; if (!(dxfVertex2D.Position == point.Position)) { Vector2D unit = (point.Position - dxfVertex2D.Position).GetUnit(); Vector2D vector2D = new Vector2D(-unit.Y, unit.X); polyline2D2N.Add(new Point2D2N(dxfVertex2D.Position, vector2D, vector2D) { IsInterpolatedPoint = isInterpolatedPoint }); dxfVertex2D = point; } } if (closed) { DxfVertex2D point = points[0]; if (dxfVertex2D.Position != point.Position) { Vector2D unit = (point.Position - dxfVertex2D.Position).GetUnit(); Vector2D vector2D = new Vector2D(-unit.Y, unit.X); polyline2D2N.Add(new Point2D2N(dxfVertex2D.Position, vector2D, vector2D) { IsInterpolatedPoint = isInterpolatedPoint }); } } else { polyline2D2N.Add(new Point2D2N(dxfVertex2D.Position) { IsInterpolatedPoint = isInterpolatedPoint }); } } return(polyline2D2N); }
internal static void smethod_5( DxfEntity entity, DrawContext.Surface context, ISurfaceGraphicsFactory graphicsFactory, IList <WW.Cad.Drawing.Polyline2D2N> polylines, bool areSurfaces, Matrix4D transform, Vector3D normal, double extrusion) { int count = polylines.Count; for (int index = 0; index < count; ++index) { WW.Cad.Drawing.Polyline2D2N polyline = polylines[index]; Class940.smethod_6(entity, context, graphicsFactory, polyline, areSurfaces, transform, normal, extrusion); } }
internal static void smethod_10( DxfEntity entity, DrawContext.Surface context, ISurfaceGraphicsFactory graphicsFactory, IList <WW.Cad.Drawing.Polyline2D2N> polylinesA, IList <WW.Cad.Drawing.Polyline2D2N> polylinesB, Matrix4D transform, Vector3D normal, bool areSurfaces) { int count = polylinesA.Count; for (int index = 0; index < count; ++index) { WW.Cad.Drawing.Polyline2D2N polylineA = polylinesA[index]; WW.Cad.Drawing.Polyline2D2N polylineB = polylinesB[index]; Class940.smethod_11(entity, context, graphicsFactory, polylineA, polylineB, transform, normal, areSurfaces); } }
public double GetLength() { return(Polyline2D2N.GetLength((IList <Point2D2N>) this, this.Closed)); }
internal static void smethod_11( DxfEntity entity, DrawContext.Surface context, ISurfaceGraphicsFactory graphicsFactory, WW.Cad.Drawing.Polyline2D2N polylineA, WW.Cad.Drawing.Polyline2D2N polylineB, Matrix4D transform, Vector3D normal, bool isSurface) { Interface41 transformer = (Interface41)context.GetTransformer().Clone(); transformer.SetPreTransform(transform); if (polylineA.Count == 1) { Point2D2N point2D2N1 = polylineA[0]; Point2D2N point2D2N2 = polylineB[0]; if (point2D2N1.Position == point2D2N2.Position) { graphicsFactory.CreatePoint(transformer.Transform(point2D2N1.Position)); } else { graphicsFactory.CreateSegment(transformer.Transform(point2D2N1.Position), transformer.Transform(point2D2N2.Position)); } } else if (polylineA.Count == 2) { Point2D2N point2D2N1 = polylineA[0]; Point2D2N point2D2N2 = polylineA[1]; Point2D2N point2D2N3 = polylineB[0]; Point2D2N point2D2N4 = polylineB[1]; Vector4D[] vector4DArray = new Vector4D[4] { transformer.Transform(point2D2N1.Position), transformer.Transform(point2D2N2.Position), transformer.Transform(point2D2N4.Position), transformer.Transform(point2D2N3.Position) }; if (isSurface) { graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray, (IList <bool>)null); } else { graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray, true); } } else { int count = polylineA.Count; bool closed = polylineA.Closed; Polyline4D polyline4D1 = DxfUtil.smethod_47(polylineA, transformer); Polyline4D polyline4D2 = DxfUtil.smethod_47(polylineB, transformer); if (isSurface) { graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4D1, (IList <Vector4D>)polyline4D2, normal, closed); } else { int index1 = 0; int num = 1; if (closed) { index1 = count - 1; num = 0; } Vector4D start = polyline4D1[index1]; Vector4D end = polyline4D2[index1]; for (int index2 = num; index2 < count; ++index2) { Vector4D vector4D1 = polyline4D1[index2]; Vector4D vector4D2 = polyline4D2[index2]; graphicsFactory.CreateSegment(start, end); start = vector4D1; end = vector4D2; } graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4D1, closed); graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4D2, closed); } } }
internal static void smethod_8( DxfEntity entity, DrawContext.Surface context, ISurfaceGraphicsFactory graphicsFactory, WW.Cad.Drawing.Polyline2D2N polylineA, WW.Cad.Drawing.Polyline2D2N polylineB, bool isSurface, Matrix4D transform, Vector3D normal, double extrusion) { Interface41 transformer = (Interface41)context.GetTransformer().Clone(); transformer.SetPreTransform(transform); Vector3D vector3D = transformer.Transform(new Vector3D(0.0, 0.0, extrusion)); Vector4D vector4D1 = (Vector4D)vector3D; if (polylineA.Count == 1) { Point2D2N point2D2N1 = polylineA[0]; Point2D2N point2D2N2 = polylineB[0]; if (point2D2N1.Position == point2D2N2.Position) { Vector4D start = transformer.Transform((WW.Math.Point3D)point2D2N1.Position); graphicsFactory.CreateSegment(start, start + vector4D1); } else { Vector4D vector4D2 = transformer.Transform(point2D2N1.Position); Vector4D vector4D3 = transformer.Transform(point2D2N2.Position); Vector4D[] vector4DArray = new Vector4D[4] { vector4D2, vector4D3, vector4D3 + vector4D1, vector4D2 + vector4D1 }; if (isSurface) { graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray, (IList <bool>)null); } else { graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray, true); } } } else if (polylineA.Count == 2) { Point2D2N point2D2N1 = polylineA[0]; Point2D2N point2D2N2 = polylineA[1]; Point2D2N point2D2N3 = polylineB[0]; Point2D2N point2D2N4 = polylineB[1]; Vector4D vector4D2 = transformer.Transform(new WW.Math.Point3D(point2D2N1.Position, 0.0)); Vector4D vector4D3 = transformer.Transform(new WW.Math.Point3D(point2D2N2.Position, 0.0)); Vector4D vector4D4 = transformer.Transform(new WW.Math.Point3D(point2D2N3.Position, 0.0)); Vector4D vector4D5 = transformer.Transform(new WW.Math.Point3D(point2D2N4.Position, 0.0)); Vector4D vector4D6 = vector4D2 + vector4D1; Vector4D vector4D7 = vector4D3 + vector4D1; Vector4D vector4D8 = vector4D4 + vector4D1; Vector4D vector4D9 = vector4D5 + vector4D1; Vector4D[] vector4DArray1 = new Vector4D[4] { vector4D2, vector4D3, vector4D5, vector4D4 }; Vector4D[] vector4DArray2 = new Vector4D[4] { vector4D6, vector4D7, vector4D9, vector4D8 }; if (isSurface) { graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray1, (IList <bool>)null); graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray2, (IList <bool>)null); graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4] { vector4D2, vector4D4, vector4D8, vector4D6 }, (IList <bool>)null); graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4] { vector4D3, vector4D5, vector4D9, vector4D7 }, (IList <bool>)null); graphicsFactory.CreateQuadStrip((IList <Vector4D>) new Vector4D[2] { vector4D2, vector4D3 }, (IList <Vector4D>) new Vector4D[2] { vector4D6, vector4D7 }, (IList <Vector3D>) new Vector3D[2] { transformer.Transform(new Vector3D(point2D2N1.StartNormal, 0.0)), transformer.Transform(new Vector3D(point2D2N1.EndNormal, 0.0)) }, 0, 1); graphicsFactory.CreateQuadStrip((IList <Vector4D>) new Vector4D[2] { vector4D8, vector4D9 }, (IList <Vector4D>) new Vector4D[2] { vector4D4, vector4D5 }, (IList <Vector3D>) new Vector3D[2] { transformer.Transform(new Vector3D(point2D2N3.StartNormal, 0.0)), transformer.Transform(new Vector3D(point2D2N3.EndNormal, 0.0)) }, 0, 1); } else { graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray1, true); graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray2, true); for (int index = 0; index < 4; ++index) { graphicsFactory.CreateSegment(vector4DArray1[index], vector4DArray2[index]); } } } else { int count = polylineA.Count; int index1 = count - 1; bool closed = polylineA.Closed; Polyline4D polyline4DBottom1 = DxfUtil.smethod_47(polylineA, transformer); Polyline4D polyline4DTop1 = DxfUtil.smethod_47(polylineB, transformer); Polyline4D polyline4DTop2 = new Polyline4D(count, closed); Polyline4D polyline4DBottom2 = new Polyline4D(count, closed); for (int index2 = 0; index2 < count; ++index2) { polyline4DTop2.Add(polyline4DBottom1[index2] + vector3D); polyline4DBottom2.Add(polyline4DTop1[index2] + vector3D); } if (isSurface) { graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4DBottom1, (IList <Vector4D>)polyline4DTop1, normal, closed); graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4DTop2, (IList <Vector4D>)polyline4DBottom2, normal, closed); if (!closed) { graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4] { polyline4DBottom1[0], polyline4DTop2[0], polyline4DBottom2[0], polyline4DTop1[0] }, (IList <bool>)null); graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4] { polyline4DBottom1[index1], polyline4DTop2[index1], polyline4DBottom2[index1], polyline4DTop1[index1] }, (IList <bool>)null); } Class940.smethod_9(entity, graphicsFactory, polylineA, transformer, polyline4DBottom1, polyline4DTop2); Class940.smethod_9(entity, graphicsFactory, polylineB, transformer, polyline4DBottom2, polyline4DTop1); if (closed) { return; } Vector4D vector4D2 = polyline4DBottom1[0]; Vector4D vector4D3 = polyline4DTop1[0]; Vector4D vector4D4 = polyline4DTop2[0]; Vector4D vector4D5 = polyline4DBottom2[0]; graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4] { vector4D2, vector4D3, vector4D5, vector4D4 }, (IList <bool>)null); int index2 = count - 1; Vector4D vector4D6 = polyline4DBottom1[index2]; Vector4D vector4D7 = polyline4DTop1[index2]; Vector4D vector4D8 = polyline4DTop2[index2]; Vector4D vector4D9 = polyline4DBottom2[index2]; graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4] { vector4D6, vector4D7, vector4D9, vector4D8 }, (IList <bool>)null); } else { int index2 = 0; int num = 1; if (closed) { index2 = count - 1; num = 0; } Vector4D start = polyline4DBottom1[index2]; Vector4D vector4D2 = polyline4DTop1[index2]; Vector4D vector4D3 = polyline4DTop2[index2]; Vector4D end = polyline4DBottom2[index2]; for (int index3 = num; index3 < count; ++index3) { Vector4D vector4D4 = polyline4DBottom1[index3]; Vector4D vector4D5 = polyline4DTop1[index3]; Vector4D vector4D6 = polyline4DTop2[index3]; Vector4D vector4D7 = polyline4DBottom2[index3]; graphicsFactory.CreateSegment(start, vector4D2); graphicsFactory.CreateSegment(vector4D3, end); graphicsFactory.CreateSegment(start, vector4D3); graphicsFactory.CreateSegment(vector4D2, end); start = vector4D4; vector4D2 = vector4D5; vector4D3 = vector4D6; end = vector4D7; } graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DBottom1, closed); graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DTop1, closed); graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DTop2, closed); graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DBottom2, closed); } } }
internal static void smethod_6( DxfEntity entity, DrawContext.Surface context, ISurfaceGraphicsFactory graphicsFactory, WW.Cad.Drawing.Polyline2D2N polyline, bool isSurface, Matrix4D transform, Vector3D normal, double extrusion) { Interface41 transformer = (Interface41)context.GetTransformer().Clone(); transformer.SetPreTransform(transform); Vector3D vector3D = transformer.Transform(new Vector3D(0.0, 0.0, extrusion)); Vector4D vector4D1 = (Vector4D)vector3D; if (polyline.Count == 1) { Point2D2N point2D2N = polyline[0]; Vector4D start = transformer.Transform(point2D2N.Position); graphicsFactory.CreateSegment(start, start + vector4D1); } else if (polyline.Count == 2) { Point2D2N point2D2N1 = polyline[0]; Point2D2N point2D2N2 = polyline[1]; Vector4D vector4D2 = transformer.Transform(point2D2N1.Position); Vector4D vector4D3 = transformer.Transform(point2D2N2.Position); Vector4D vector4D4 = vector4D2 + vector4D1; Vector4D vector4D5 = vector4D3 + vector4D1; if (isSurface) { graphicsFactory.CreateQuadStrip((IList <Vector4D>) new Vector4D[2] { vector4D2, vector4D3 }, (IList <Vector4D>) new Vector4D[2] { vector4D4, vector4D5 }, (IList <Vector3D>) new Vector3D[2] { transformer.Transform(new Vector3D(point2D2N1.StartNormal, 0.0)), transformer.Transform(new Vector3D(point2D2N1.EndNormal, 0.0)) }, 0, 1); } else { graphicsFactory.CreatePolyline((IList <Vector4D>) new Vector4D[4] { vector4D2, vector4D3, vector4D5, vector4D4 }, true); } } else { int count = polyline.Count; bool closed = polyline.Closed; Polyline4D polyline4DBottom = DxfUtil.smethod_47(polyline, transformer); Polyline4D polyline4DTop = new Polyline4D(count, closed); for (int index = 0; index < count; ++index) { polyline4DTop.Add(polyline4DBottom[index] + vector3D); } if (isSurface) { Class940.smethod_9(entity, graphicsFactory, polyline, transformer, polyline4DBottom, polyline4DTop); } else { for (int index = 0; index < count; ++index) { Vector4D start = polyline4DBottom[index]; Vector4D end = polyline4DTop[index]; graphicsFactory.CreateSegment(start, end); } graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DBottom, closed); graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DTop, closed); } } }