VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkParametricFunctionSource.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 =========================================================================*/ 00049 #ifndef vtkParametricFunctionSource_h 00050 #define vtkParametricFunctionSource_h 00051 00052 #include "vtkFiltersSourcesModule.h" // For export macro 00053 #include "vtkPolyDataAlgorithm.h" 00054 00055 class vtkCellArray; 00056 class vtkParametricFunction; 00057 00058 class VTKFILTERSSOURCES_EXPORT vtkParametricFunctionSource : public vtkPolyDataAlgorithm 00059 { 00060 public: 00061 vtkTypeMacro(vtkParametricFunctionSource,vtkPolyDataAlgorithm); 00062 void PrintSelf(ostream& os, vtkIndent indent); 00063 00066 static vtkParametricFunctionSource *New(); 00067 00069 00070 virtual void SetParametricFunction(vtkParametricFunction*); 00071 vtkGetObjectMacro(ParametricFunction,vtkParametricFunction); 00073 00075 00078 vtkSetClampMacro(UResolution,int,2,VTK_INT_MAX); 00079 vtkGetMacro(UResolution,int); 00081 00083 00086 vtkSetClampMacro(VResolution,int,2,VTK_INT_MAX); 00087 vtkGetMacro(VResolution,int); 00089 00091 00094 vtkSetClampMacro(WResolution,int,2,VTK_INT_MAX); 00095 vtkGetMacro(WResolution,int); 00097 00099 00103 vtkBooleanMacro(GenerateTextureCoordinates,int); 00104 vtkSetClampMacro(GenerateTextureCoordinates,int,0,1); 00105 vtkGetMacro(GenerateTextureCoordinates,int); 00107 00109 00112 vtkBooleanMacro(GenerateNormals,int); 00113 vtkSetClampMacro(GenerateNormals,int,0,1); 00114 vtkGetMacro(GenerateNormals,int); 00116 00118 00136 enum SCALAR_MODE { SCALAR_NONE = 0, 00137 SCALAR_U, SCALAR_V, 00138 SCALAR_U0, SCALAR_V0, SCALAR_U0V0, 00139 SCALAR_MODULUS, SCALAR_PHASE, SCALAR_QUADRANT, 00140 SCALAR_X, SCALAR_Y, SCALAR_Z, SCALAR_DISTANCE, 00141 SCALAR_FUNCTION_DEFINED }; 00143 00145 00147 vtkSetClampMacro(ScalarMode, int, SCALAR_NONE, SCALAR_FUNCTION_DEFINED); 00148 vtkGetMacro(ScalarMode, int); 00149 void SetScalarModeToNone( void ) {this->SetScalarMode(SCALAR_NONE);} 00150 void SetScalarModeToU( void ) {this->SetScalarMode(SCALAR_U);} 00151 void SetScalarModeToV( void ) {this->SetScalarMode(SCALAR_V);} 00152 void SetScalarModeToU0( void ) {this->SetScalarMode(SCALAR_U0);} 00153 void SetScalarModeToV0( void ) {this->SetScalarMode(SCALAR_V0);} 00154 void SetScalarModeToU0V0( void ) {this->SetScalarMode(SCALAR_U0V0);} 00155 void SetScalarModeToModulus( void ) {this->SetScalarMode(SCALAR_MODULUS);} 00156 void SetScalarModeToPhase( void ) {this->SetScalarMode(SCALAR_PHASE);} 00157 void SetScalarModeToQuadrant( void ) {this->SetScalarMode(SCALAR_QUADRANT);} 00158 void SetScalarModeToX( void ) {this->SetScalarMode(SCALAR_X);} 00159 void SetScalarModeToY( void ) {this->SetScalarMode(SCALAR_Y);} 00160 void SetScalarModeToZ( void ) {this->SetScalarMode(SCALAR_Z);} 00161 void SetScalarModeToDistance( void ) {this->SetScalarMode(SCALAR_DISTANCE);} 00162 void SetScalarModeToFunctionDefined( void ) 00163 {this->SetScalarMode(SCALAR_FUNCTION_DEFINED);} 00165 00167 unsigned long GetMTime(); 00168 00170 00173 vtkSetMacro(OutputPointsPrecision,int); 00174 vtkGetMacro(OutputPointsPrecision,int); 00176 00177 protected: 00178 vtkParametricFunctionSource(); 00179 virtual ~vtkParametricFunctionSource(); 00180 00181 // Usual data generation method 00182 int RequestData(vtkInformation *info, vtkInformationVector **input, 00183 vtkInformationVector *output); 00184 00185 // Variables 00186 vtkParametricFunction *ParametricFunction; 00187 00188 int UResolution; 00189 int VResolution; 00190 int WResolution; 00191 int GenerateTextureCoordinates; 00192 int GenerateNormals; 00193 int ScalarMode; 00194 int OutputPointsPrecision; 00195 00196 private: 00197 // Create output depending on function dimension 00198 void Produce1DOutput(vtkInformationVector *output); 00199 void Produce2DOutput(vtkInformationVector *output); 00200 00208 void MakeTriangles ( vtkCellArray * strips, int PtsU, int PtsV ); 00209 00210 vtkParametricFunctionSource(const vtkParametricFunctionSource&); // Not implemented. 00211 void operator=(const vtkParametricFunctionSource&); // Not implemented. 00212 00213 }; 00214 00215 #endif