VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkRibbonFilter.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 =========================================================================*/ 00041 #ifndef __vtkRibbonFilter_h 00042 #define __vtkRibbonFilter_h 00043 00044 #include "vtkFiltersModelingModule.h" // For export macro 00045 #include "vtkPolyDataAlgorithm.h" 00046 00047 #define VTK_TCOORDS_OFF 0 00048 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1 00049 #define VTK_TCOORDS_FROM_LENGTH 2 00050 #define VTK_TCOORDS_FROM_SCALARS 3 00051 00052 class vtkCellArray; 00053 class vtkCellData; 00054 class vtkDataArray; 00055 class vtkFloatArray; 00056 class vtkPointData; 00057 class vtkPoints; 00058 00059 class VTKFILTERSMODELING_EXPORT vtkRibbonFilter : public vtkPolyDataAlgorithm 00060 { 00061 public: 00062 vtkTypeMacro(vtkRibbonFilter,vtkPolyDataAlgorithm); 00063 void PrintSelf(ostream& os, vtkIndent indent); 00064 00067 static vtkRibbonFilter *New(); 00068 00070 00072 vtkSetClampMacro(Width,double,0,VTK_DOUBLE_MAX); 00073 vtkGetMacro(Width,double); 00075 00077 00079 vtkSetClampMacro(Angle,double,0,360); 00080 vtkGetMacro(Angle,double); 00082 00084 00086 vtkSetMacro(VaryWidth,int); 00087 vtkGetMacro(VaryWidth,int); 00088 vtkBooleanMacro(VaryWidth,int); 00090 00092 00094 vtkSetMacro(WidthFactor,double); 00095 vtkGetMacro(WidthFactor,double); 00097 00099 00101 vtkSetVector3Macro(DefaultNormal,double); 00102 vtkGetVectorMacro(DefaultNormal,double,3); 00104 00106 00108 vtkSetMacro(UseDefaultNormal,int); 00109 vtkGetMacro(UseDefaultNormal,int); 00110 vtkBooleanMacro(UseDefaultNormal,int); 00112 00114 00116 vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF, 00117 VTK_TCOORDS_FROM_SCALARS); 00118 vtkGetMacro(GenerateTCoords,int); 00119 void SetGenerateTCoordsToOff() 00120 {this->SetGenerateTCoords(VTK_TCOORDS_OFF);} 00121 void SetGenerateTCoordsToNormalizedLength() 00122 {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);} 00123 void SetGenerateTCoordsToUseLength() 00124 {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);} 00125 void SetGenerateTCoordsToUseScalars() 00126 {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);} 00127 const char *GetGenerateTCoordsAsString(); 00129 00131 00135 vtkSetClampMacro(TextureLength,double,0.000001,VTK_INT_MAX); 00136 vtkGetMacro(TextureLength,double); 00138 00139 protected: 00140 vtkRibbonFilter(); 00141 ~vtkRibbonFilter(); 00142 00143 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00144 double Width; 00145 double Angle; 00146 int VaryWidth; //controls whether width varies with scalar data 00147 double WidthFactor; 00148 double DefaultNormal[3]; 00149 int UseDefaultNormal; 00150 int GenerateTCoords; //control texture coordinate generation 00151 double TextureLength; //this length is mapped to [0,1) texture space 00152 00153 // Helper methods 00154 int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 00155 vtkPoints *inPts, vtkPoints *newPts, 00156 vtkPointData *pd, vtkPointData *outPD, 00157 vtkFloatArray *newNormals, vtkDataArray *inScalars, 00158 double range[2], vtkDataArray *inNormals); 00159 void GenerateStrip(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 00160 vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD, 00161 vtkCellArray *newStrips); 00162 void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 00163 vtkPoints *inPts, vtkDataArray *inScalars, 00164 vtkFloatArray *newTCoords); 00165 vtkIdType ComputeOffset(vtkIdType offset,vtkIdType npts); 00166 00167 // Helper data members 00168 double Theta; 00169 00170 private: 00171 vtkRibbonFilter(const vtkRibbonFilter&); // Not implemented. 00172 void operator=(const vtkRibbonFilter&); // Not implemented. 00173 }; 00174 00175 #endif