예제 #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());
        }