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 
00112 protected:
00113   vtkEllipticalButtonSource();
00114   ~vtkEllipticalButtonSource() {}
00115 
00116   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00117 
00118   double Width;
00119   double Height;
00120   double Depth;
00121   int   CircumferentialResolution;
00122   int   TextureResolution;
00123   int   ShoulderResolution;
00124   double RadialRatio;
00125 
00126 private:
00127   //internal variable related to axes of ellipsoid
00128   double A;
00129   double A2;
00130   double B;
00131   double B2;
00132   double C;
00133   double C2;
00134 
00135   double ComputeDepth(int inTextureRegion, double x, double y, double n[3]);
00136   void InterpolateCurve(int inTextureRegion, vtkPoints *newPts, int numPts,
00137                         vtkFloatArray *normals, vtkFloatArray *tcoords,
00138                         int res, int c1StartPoint,int c1Incr,
00139                         int c2StartPoint,int s2Incr, int startPoint,int incr);
00140   void CreatePolygons(vtkCellArray *newPolys, int num, int res, int startIdx);
00141   void IntersectEllipseWithLine(double a2, double b2, double dX, double dY,
00142                                 double& xe, double& ye);
00143 
00144   vtkEllipticalButtonSource(const vtkEllipticalButtonSource&);  // Not implemented.
00145   void operator=(const vtkEllipticalButtonSource&);  // Not implemented.
00146 };
00147 
00148 #endif
00149 
00150