VTK
dox/Filters/Sources/vtkEllipticalButtonSource.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkEllipticalButtonSource.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00042 #ifndef __vtkEllipticalButtonSource_h
00043 #define __vtkEllipticalButtonSource_h
00044 
00045 #include "vtkFiltersSourcesModule.h" // For export macro
00046 #include "vtkButtonSource.h"
00047 
00048 class vtkCellArray;
00049 class vtkFloatArray;
00050 class vtkPoints;
00051 
00052 class VTKFILTERSSOURCES_EXPORT vtkEllipticalButtonSource : public vtkButtonSource
00053 {
00054 public:
00055   void PrintSelf(ostream& os, vtkIndent indent);
00056   vtkTypeMacro(vtkEllipticalButtonSource,vtkButtonSource);
00057 
00059   static vtkEllipticalButtonSource *New();
00060 
00062 
00063   vtkSetClampMacro(Width,double,0.0,VTK_DOUBLE_MAX);
00064   vtkGetMacro(Width,double);
00066 
00068 
00069   vtkSetClampMacro(Height,double,0.0,VTK_DOUBLE_MAX);
00070   vtkGetMacro(Height,double);
00072 
00074 
00075   vtkSetClampMacro(Depth,double,0.0,VTK_DOUBLE_MAX);
00076   vtkGetMacro(Depth,double);
00078 
00080 
00082   vtkSetClampMacro(CircumferentialResolution,int,4,VTK_INT_MAX);
00083   vtkGetMacro(CircumferentialResolution,int);
00085 
00087 
00089   vtkSetClampMacro(TextureResolution,int,1,VTK_INT_MAX);
00090   vtkGetMacro(TextureResolution,int);
00092 
00094 
00096   vtkSetClampMacro(ShoulderResolution,int,1,VTK_INT_MAX);
00097   vtkGetMacro(ShoulderResolution,int);
00099 
00101 
00108   vtkSetClampMacro(RadialRatio,double,1.0,VTK_DOUBLE_MAX);
00109   vtkGetMacro(RadialRatio,double);
00111 
00113 
00117   vtkSetMacro(OutputPointsPrecision,int);
00118   vtkGetMacro(OutputPointsPrecision,int);
00120 
00121 protected:
00122   vtkEllipticalButtonSource();
00123   ~vtkEllipticalButtonSource() {}
00124 
00125   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00126 
00127   double Width;
00128   double Height;
00129   double Depth;
00130   int    CircumferentialResolution;
00131   int    TextureResolution;
00132   int    ShoulderResolution;
00133   int    OutputPointsPrecision;
00134   double RadialRatio;
00135 
00136 private:
00137   //internal variable related to axes of ellipsoid
00138   double A;
00139   double A2;
00140   double B;
00141   double B2;
00142   double C;
00143   double C2;
00144 
00145   double ComputeDepth(int inTextureRegion, double x, double y, double n[3]);
00146   void InterpolateCurve(int inTextureRegion, vtkPoints *newPts, int numPts,
00147                         vtkFloatArray *normals, vtkFloatArray *tcoords,
00148                         int res, int c1StartPoint,int c1Incr,
00149                         int c2StartPoint,int s2Incr, int startPoint,int incr);
00150   void CreatePolygons(vtkCellArray *newPolys, int num, int res, int startIdx);
00151   void IntersectEllipseWithLine(double a2, double b2, double dX, double dY,
00152                                 double& xe, double& ye);
00153 
00154   vtkEllipticalButtonSource(const vtkEllipticalButtonSource&);  // Not implemented.
00155   void operator=(const vtkEllipticalButtonSource&);  // Not implemented.
00156 };
00157 
00158 #endif
00159 
00160