Ejemplo n.º 1
0
 private Polygon3D generateSection(Color color, double initialAngle, double angle)
 {
     List<Point3D> upperVertices = new List<Point3D>();
     List<Point3D> lowerVertices = new List<Point3D>();
     int upperRadius = 200;
     int lowerRadius = 150;
     Point3D initialUpperPoint = new Point3D(0, upperRadius, 0);
     Point3D initialLowerPoint = new Point3D(0, lowerRadius, 0);
     initialUpperPoint.Rotate(Axes.Z, initialAngle);
     initialLowerPoint.Rotate(Axes.Z, initialAngle);
     int steps = (int)radToDeg(angle);
     for (int i = 0; i <= steps; i++)
     {
         Point3D upperPoint = initialUpperPoint.Clone();
         Point3D lowerPoint = initialLowerPoint.Clone();
         double rotationAngle = angle / steps * i;
         upperPoint.Rotate(Axes.Z, rotationAngle);
         lowerPoint.Rotate(Axes.Z, rotationAngle);
         upperVertices.Add(upperPoint);
         lowerVertices.Add(lowerPoint);
     }
     lowerVertices.Reverse();
     upperVertices.AddRange(lowerVertices);
     return new Polygon3D(upperVertices, color);
 }