1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkEllipseArcSource.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /**
16  * @class   vtkEllipseArcSource
17  * @brief   create an elliptical arc
18  *
19  *
20  * vtkEllipseArcSource is a source object that creates an elliptical arc
21  * defined by a normal, a center and the major radius vector.
22  * You can define an angle to draw only a section of the ellipse. The number of
23  * segments composing the polyline is controlled by setting the object
24  * resolution.
25  *
26  * @sa
27  * vtkArcSource
28 */
29 
30 #ifndef vtkEllipseArcSource_h
31 #define vtkEllipseArcSource_h
32 
33 #include "vtkFiltersSourcesModule.h" // For export macro
34 #include "vtkPolyDataAlgorithm.h"
35 
36 class VTKFILTERSSOURCES_EXPORT vtkEllipseArcSource : public vtkPolyDataAlgorithm
37 {
38 public:
39   static vtkEllipseArcSource *New();
40   vtkTypeMacro(vtkEllipseArcSource, vtkPolyDataAlgorithm);
41   void PrintSelf(ostream& os, vtkIndent indent) override;
42 
43   //@{
44   /**
45    * Set position of the center of the ellipse that define the arc.
46    * Default is 0, 0, 0.
47    */
48   vtkSetVector3Macro(Center, double);
49   vtkGetVectorMacro(Center, double, 3);
50   //@}
51 
52   //@{
53   /**
54    * Set normal vector. Represents the plane in which the ellipse will be drawn.
55    * Default 0, 0, 1.
56    */
57   vtkSetVector3Macro(Normal, double);
58   vtkGetVectorMacro(Normal, double, 3);
59   //@}
60 
61   //@{
62   /**
63    * Set Major Radius Vector. It defines the origin of polar angle and the major
64    * radius size.
65    * Default is 1, 0, 0.
66    */
67   vtkSetVector3Macro(MajorRadiusVector, double);
68   vtkGetVectorMacro(MajorRadiusVector, double, 3);
69   //@}
70 
71   //@{
72   /**
73    * Set the start angle. The angle where the plot begins.
74    * Default is 0.
75    */
76   vtkSetClampMacro(StartAngle, double, -360.0, 360.0);
77   vtkGetMacro(StartAngle, double);
78   //@}
79 
80   //@{
81   /**
82    * Angular sector occupied by the arc, beginning at Start Angle
83    * Default is 90.
84    */
85   vtkSetClampMacro(SegmentAngle, double, 0.0, 360.0);
86   vtkGetMacro(SegmentAngle, double);
87   //@}
88 
89   //@{
90   /**
91    * Divide line into resolution number of pieces.
92    * Note: if Resolution is set to 1 the arc is a
93    * straight line. Default is 100.
94    */
95   vtkSetClampMacro(Resolution, int, 1, VTK_INT_MAX);
96   vtkGetMacro(Resolution, int);
97   //@}
98 
99   //@{
100   /**
101    * Set/get the desired precision for the output points.
102    * vtkAlgorithm::SINGLE_PRECISION - Output single-precision floating point,
103    * This is the default.
104    * vtkAlgorithm::DOUBLE_PRECISION - Output double-precision floating point.
105    */
106   vtkSetMacro(OutputPointsPrecision, int);
107   vtkGetMacro(OutputPointsPrecision, int);
108   //@}
109 
110   //@{
111   /**
112    * Set the ratio of the ellipse, i.e. the ratio b/a _ b: minor radius;
113    * a: major radius
114    * default is 1.
115    */
116   vtkSetClampMacro(Ratio, double, 0.001, 100.0);
117   vtkGetMacro(Ratio, double);
118   //@}
119 
120 protected:
121   vtkEllipseArcSource();
~vtkEllipseArcSource()122   ~vtkEllipseArcSource() override {}
123 
124   int RequestData(vtkInformation *, vtkInformationVector **,
125     vtkInformationVector *) override;
126 
127   double Center[3];
128   double Normal[3];
129   double MajorRadiusVector[3];
130   double StartAngle;
131   double SegmentAngle;
132   int Resolution;
133   double Ratio;
134   int OutputPointsPrecision;
135 
136 private:
137   vtkEllipseArcSource(const vtkEllipseArcSource&) = delete;
138   void operator=(const vtkEllipseArcSource&) = delete;
139 };
140 
141 #endif
142