예제 #1
0
        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);
        }
예제 #2
0
        private Polyline2D method_24(DxfVertex2DCollection points)
        {
            bool       closed     = this.Closed;
            int        count      = points.Count;
            Polyline2D polyline2D = new Polyline2D(count, closed);

            if (count > 0)
            {
                DxfVertex2D dxfVertex2D = points[0];
                polyline2D.Add(dxfVertex2D.Position);
                for (int index = 1; index < count; ++index)
                {
                    DxfVertex2D point = points[index];
                    if (!(dxfVertex2D.Position == point.Position))
                    {
                        polyline2D.Add(point.Position);
                        dxfVertex2D = point;
                    }
                }
                if (closed && count > 1 && polyline2D[0] == polyline2D[polyline2D.Count - 1])
                {
                    polyline2D.RemoveAt(polyline2D.Count - 1);
                }
            }
            return(polyline2D);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public override void CopyFrom(DxfHandledObject from, CloneContext cloneContext)
        {
            base.CopyFrom(from, cloneContext);
            DxfVertex2D dxfVertex2D = (DxfVertex2D)from;

            this.point2D_0 = dxfVertex2D.point2D_0;
            this.double_1  = dxfVertex2D.double_1;
            this.double_2  = dxfVertex2D.double_2;
            this.double_3  = dxfVertex2D.double_3;
            this.double_4  = dxfVertex2D.double_4;
            this.enum51_0  = dxfVertex2D.enum51_0;
        }
예제 #5
0
        public override IGraphCloneable Clone(CloneContext cloneContext)
        {
            DxfVertex2D dxfVertex2D = (DxfVertex2D)cloneContext.GetExistingClone((IGraphCloneable)this);

            if (dxfVertex2D == null)
            {
                dxfVertex2D = new DxfVertex2D();
                cloneContext.RegisterClone((IGraphCloneable)this, (IGraphCloneable)dxfVertex2D);
                dxfVertex2D.CopyFrom((DxfHandledObject)this, cloneContext);
            }
            return((IGraphCloneable)dxfVertex2D);
        }
예제 #6
0
        private WW.Cad.Drawing.Polyline2D2WN method_27(
            DxfVertex2DCollection points,
            bool isInterpolatedPoint)
        {
            bool closed = this.Closed;
            int  count  = points.Count;

            WW.Cad.Drawing.Polyline2D2WN polyline2D2Wn = new WW.Cad.Drawing.Polyline2D2WN(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);
                        polyline2D2Wn.Add(new Point2D2WN(dxfVertex2D.Position, dxfVertex2D.StartWidth, dxfVertex2D.EndWidth, 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);
                        polyline2D2Wn.Add(new Point2D2WN(dxfVertex2D.Position, dxfVertex2D.StartWidth, dxfVertex2D.EndWidth, vector2D, vector2D)
                        {
                            IsInterpolatedPoint = isInterpolatedPoint
                        });
                    }
                }
                else
                {
                    polyline2D2Wn.Add(new Point2D2WN(dxfVertex2D.Position)
                    {
                        IsInterpolatedPoint = isInterpolatedPoint
                    });
                }
            }
            return(polyline2D2Wn);
        }
예제 #7
0
        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);
        }
예제 #8
0
        private WW.Cad.Drawing.Polyline2D2WN method_31(int power, int noOfSplineLineParts)
        {
            WW.Cad.Drawing.Polyline2D2WN polyline2D2Wn = new WW.Cad.Drawing.Polyline2D2WN();
            int count = this.dxfVertex2DCollection_0.Count;

            if (count <= power)
            {
                return(this.method_23());
            }
            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   num3   = 0.0;
            double   num4   = 0.0;
            int      num5   = -1;

            double[,] derivatives = new double[2, power + 1];
            Point2D2WN point2D2Wn1 = (Point2D2WN)null;
            int        num6        = 0;
            double     u           = 0.0;

            while (num6 < num1)
            {
                double d    = (double)(count - 1) * u / maxU;
                int    num7 = (int)System.Math.Floor(d);
                if (num5 != num7)
                {
                    DxfVertex2D dxfVertex2D = this.dxfVertex2DCollection_0[num7 % count];
                    num3 = dxfVertex2D.StartWidth == 0.0 ? this.DefaultStartWidth : dxfVertex2D.StartWidth;
                    num4 = (dxfVertex2D.EndWidth == 0.0 ? this.DefaultEndWidth : dxfVertex2D.EndWidth) - num3;
                }
                double num8 = d - (double)num7;
                num5 = num7;
                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();
                Point2D2WN point2D2Wn2 = new Point2D2WN(zero1, num3 + num8 * num4, num3 + (num8 + num2) * num4)
                {
                    IsInterpolatedPoint = true
                };
                point2D2Wn2.StartNormal = unit;
                if (point2D2Wn1 != null)
                {
                    point2D2Wn1.EndNormal = unit;
                }
                polyline2D2Wn.Add(point2D2Wn2);
                point2D2Wn1 = point2D2Wn2;
                ++num6;
                u += num2;
            }
            if (this.Closed)
            {
                polyline2D2Wn[num1 - 1].EndNormal = polyline2D2Wn[0].StartNormal;
            }
            return(polyline2D2Wn);
        }
예제 #9
0
 public virtual void Visit(DxfVertex2D vertex)
 {
 }
예제 #10
0
 public virtual void Visit(DxfVertex2D vertex)
 {
     this.VisitVertex((DxfVertex)vertex);
 }