VTK
dox/Graphics/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 "vtkButtonSource.h"
00046 
00047 class vtkCellArray;
00048 class vtkFloatArray;
00049 class vtkPoints;
00050 
00051 class VTK_GRAPHICS_EXPORT vtkEllipticalButtonSource : public vtkButtonSource
00052 {
00053 public:
00054   void PrintSelf(ostream& os, vtkIndent indent);
00055   vtkTypeMacro(vtkEllipticalButtonSource,vtkButtonSource);
00056 
00058   static vtkEllipticalButtonSource *New();
00059 
00061 
00062   vtkSetClampMacro(Width,double,0.0,VTK_DOUBLE_MAX);
00063   vtkGetMacro(Width,double);
00065 
00067 
00068   vtkSetClampMacro(Height,double,0.0,VTK_DOUBLE_MAX);
00069   vtkGetMacro(Height,double);
00071 
00073 
00074   vtkSetClampMacro(Depth,double,0.0,VTK_DOUBLE_MAX);
00075   vtkGetMacro(Depth,double);
00077 
00079 
00081   vtkSetClampMacro(CircumferentialResolution,int,4,VTK_LARGE_INTEGER);
00082   vtkGetMacro(CircumferentialResolution,int);
00084 
00086 
00088   vtkSetClampMacro(TextureResolution,int,1,VTK_LARGE_INTEGER);
00089   vtkGetMacro(TextureResolution,int);
00091 
00093 
00095   vtkSetClampMacro(ShoulderResolution,int,1,VTK_LARGE_INTEGER);
00096   vtkGetMacro(ShoulderResolution,int);
00098 
00100 
00107   vtkSetClampMacro(RadialRatio,double,1.0,VTK_DOUBLE_MAX);
00108   vtkGetMacro(RadialRatio,double);
00110 
00111 protected:
00112   vtkEllipticalButtonSource();
00113   ~vtkEllipticalButtonSource() {}
00114 
00115   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00116 
00117   double Width;
00118   double Height;
00119   double Depth;
00120   int   CircumferentialResolution;
00121   int   TextureResolution;
00122   int   ShoulderResolution;
00123   double RadialRatio;
00124 
00125 private:
00126   //internal variable related to axes of ellipsoid
00127   double A;
00128   double A2;
00129   double B;
00130   double B2;
00131   double C;
00132   double C2;
00133 
00134   double ComputeDepth(int inTextureRegion, double x, double y, double n[3]);
00135   void InterpolateCurve(int inTextureRegion, vtkPoints *newPts, int numPts,
00136                         vtkFloatArray *normals, vtkFloatArray *tcoords,
00137                         int res, int c1StartPoint,int c1Incr,
00138                         int c2StartPoint,int s2Incr, int startPoint,int incr);
00139   void CreatePolygons(vtkCellArray *newPolys, int num, int res, int startIdx);
00140   void IntersectEllipseWithLine(double a2, double b2, double dX, double dY,
00141                                 double& xe, double& ye);
00142 
00143   vtkEllipticalButtonSource(const vtkEllipticalButtonSource&);  // Not implemented.
00144   void operator=(const vtkEllipticalButtonSource&);  // Not implemented.
00145 };
00146 
00147 #endif
00148 
00149