예제 #1
0
        Coordinate[] GetTessellatedCurveCoordinates(CircularArc3d curve)
        {
            var coordinateList = new CoordinateList();

            if (curve.StartPoint != curve.EndPoint)
            {
                switch (this.CurveTessellationMethod)
                {
                case CurveTessellation.None:
                    coordinateList.Add(this.ReadCoordinate(curve.StartPoint));
                    coordinateList.Add(this.ReadCoordinate(curve.EndPoint));
                    break;

                case CurveTessellation.Linear:
                {
                    var samplePoints = curve.GetSamplePoints((int)Math.Round(this.CurveTessellationValue));
                    for (int i = 0; i < samplePoints.Length; i++)
                    {
                        Point3d point3D = samplePoints[i].Point;
                        coordinateList.Add(this.ReadCoordinate(point3D));
                    }
                    break;
                }

                case CurveTessellation.Scaled:
                {
                    double num  = curve.GetArea(curve.GetParameterOf(curve.StartPoint), curve.GetParameterOf(curve.EndPoint)) * this.CurveTessellationValue;
                    double num2 = Math.Acos((curve.Radius - 1.0 / (num / 2.0)) / curve.Radius);
                    int    num3 = (int)Math.Round(6.2831853071795862 / num2);
                    if (num3 < 8)
                    {
                        num3 = 8;
                    }
                    if (num3 > 128)
                    {
                        num3 = 128;
                    }

                    var samplePoints2 = curve.GetSamplePoints(num3);
                    for (int j = 0; j < samplePoints2.Length; j++)
                    {
                        var point3d2 = samplePoints2[j].Point;
                        coordinateList.Add(this.ReadCoordinate(point3d2));
                    }
                    break;
                }
                }
            }
            return(coordinateList.ToCoordinateArray());
        }
예제 #2
0
        //This function gets the 5 points on the passed arc and adds those points
        //to passed point array (pointList)
        static public void BreakArc(ref Arc arc, ref Point3dCollection pointList)
        {
            CircularArc3d arcseg = new CircularArc3d(arc.Center, arc.Normal, arc.Normal.GetPerpendicularVector(),
                                                     arc.Radius, arc.StartAngle, arc.EndAngle);

            var pointArray = arcseg.GetSamplePoints(5);

            bool bReverse = false;

            //Whether to bReverse the reading of points from line, this case is valid
            //only if this function is called for line segment of polyline.
            if (pointList.Count > 0)
            {
                Point3d currentPoint = pointList[pointList.Count - 1];

                if (currentPoint != pointArray[0].Point)
                {
                    bReverse = true;
                }
            }
            int nLength = pointArray.Length;
            int nIndex  = 0;

            if (bReverse == false)
            {
                while (nIndex < nLength)
                {
                    if (pointList.Contains(pointArray[nIndex].Point) == false)
                    {
                        pointList.Add(pointArray[nIndex].Point);

                        DBPoint point = new DBPoint(pointArray[nIndex].Point);
                        point.ColorIndex = 1;
                        point.SetDatabaseDefaults();
                        TGpoints.Add(point);
                    }
                    nIndex++;
                }
            }
            else
            {
                nIndex = nLength;
                while (nIndex > 0)
                {
                    nIndex = nIndex - 1;
                    if (pointList.Contains(pointArray[nIndex].Point) == false)
                    {
                        pointList.Add(pointArray[nIndex].Point);

                        DBPoint point = new DBPoint(pointArray[nIndex].Point);
                        point.ColorIndex = 1;
                        point.SetDatabaseDefaults();
                        TGpoints.Add(point);
                    }
                }
            }
        }