VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkClipClosedSurface.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 __vtkClipClosedSurface_h 00043 #define __vtkClipClosedSurface_h 00044 00045 #include "vtkFiltersGeneralModule.h" // For export macro 00046 #include "vtkPolyDataAlgorithm.h" 00047 00048 class vtkPlaneCollection; 00049 class vtkUnsignedCharArray; 00050 class vtkDoubleArray; 00051 class vtkIdTypeArray; 00052 class vtkCellArray; 00053 class vtkPointData; 00054 class vtkCellData; 00055 class vtkPolygon; 00056 class vtkIdList; 00057 class vtkCCSEdgeLocator; 00058 00059 enum { 00060 VTK_CCS_SCALAR_MODE_NONE = 0, 00061 VTK_CCS_SCALAR_MODE_COLORS = 1, 00062 VTK_CCS_SCALAR_MODE_LABELS = 2 00063 }; 00064 00065 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm 00066 { 00067 public: 00068 static vtkClipClosedSurface *New(); 00069 vtkTypeMacro(vtkClipClosedSurface,vtkPolyDataAlgorithm); 00070 void PrintSelf(ostream& os, vtkIndent indent); 00071 00073 00074 virtual void SetClippingPlanes(vtkPlaneCollection *planes); 00075 vtkGetObjectMacro(ClippingPlanes,vtkPlaneCollection); 00077 00079 00082 vtkSetMacro(Tolerance, double); 00083 vtkGetMacro(Tolerance, double); 00085 00087 00089 vtkSetMacro(PassPointData, int); 00090 vtkBooleanMacro(PassPointData, int); 00091 vtkGetMacro(PassPointData, int); 00093 00095 00097 vtkSetMacro(GenerateOutline, int); 00098 vtkBooleanMacro(GenerateOutline, int); 00099 vtkGetMacro(GenerateOutline, int); 00101 00103 00105 vtkSetMacro(GenerateFaces, int); 00106 vtkBooleanMacro(GenerateFaces, int); 00107 vtkGetMacro(GenerateFaces, int); 00109 00111 00117 vtkSetClampMacro(ScalarMode, int, 00118 VTK_CCS_SCALAR_MODE_NONE, VTK_CCS_SCALAR_MODE_LABELS); 00119 void SetScalarModeToNone() { 00120 this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); }; 00121 void SetScalarModeToColors() { 00122 this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); }; 00123 void SetScalarModeToLabels() { 00124 this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); }; 00125 vtkGetMacro(ScalarMode, int); 00126 const char *GetScalarModeAsString(); 00128 00130 00134 vtkSetVector3Macro(BaseColor, double); 00135 vtkGetVector3Macro(BaseColor, double); 00137 00139 00142 vtkSetVector3Macro(ClipColor, double); 00143 vtkGetVector3Macro(ClipColor, double); 00145 00147 00150 vtkSetMacro(ActivePlaneId, int); 00151 vtkGetMacro(ActivePlaneId, int); 00153 00155 00158 vtkSetVector3Macro(ActivePlaneColor, double); 00159 vtkGetVector3Macro(ActivePlaneColor, double); 00161 00163 00167 vtkSetMacro(TriangulationErrorDisplay, int); 00168 vtkBooleanMacro(TriangulationErrorDisplay, int); 00169 vtkGetMacro(TriangulationErrorDisplay, int); 00171 00172 protected: 00173 vtkClipClosedSurface(); 00174 ~vtkClipClosedSurface(); 00175 00176 vtkPlaneCollection *ClippingPlanes; 00177 00178 double Tolerance; 00179 00180 int PassPointData; 00181 int GenerateOutline; 00182 int GenerateFaces; 00183 int ActivePlaneId; 00184 int ScalarMode; 00185 double BaseColor[3]; 00186 double ClipColor[3]; 00187 double ActivePlaneColor[3]; 00188 00189 int TriangulationErrorDisplay; 00190 00191 vtkIdList *IdList; 00192 00193 virtual int ComputePipelineMTime( 00194 vtkInformation* request, vtkInformationVector** inputVector, 00195 vtkInformationVector* outputVector, int requestFromOutputPort, 00196 unsigned long* mtime); 00197 00198 virtual int RequestData( 00199 vtkInformation* request, vtkInformationVector** inputVector, 00200 vtkInformationVector* outputVector); 00201 00203 00204 void ClipLines( 00205 vtkPoints *points, vtkDoubleArray *pointScalars, 00206 vtkPointData *pointData, vtkCCSEdgeLocator *edgeLocator, 00207 vtkCellArray *inputCells, vtkCellArray *outputLines, 00208 vtkCellData *inCellData, vtkCellData *outLineData); 00210 00212 00216 void ClipAndContourPolys( 00217 vtkPoints *points, vtkDoubleArray *pointScalars, vtkPointData *pointData, 00218 vtkCCSEdgeLocator *edgeLocator, int triangulate, 00219 vtkCellArray *inputCells, vtkCellArray *outputPolys, 00220 vtkCellArray *outputLines, vtkCellData *inPolyData, 00221 vtkCellData *outPolyData, vtkCellData *outLineData); 00223 00225 00229 static int InterpolateEdge( 00230 vtkPoints *points, vtkPointData *pointData, 00231 vtkCCSEdgeLocator *edgeLocator, double tol, 00232 vtkIdType i0, vtkIdType i1, double v0, double v1, vtkIdType &i); 00234 00236 00239 int TriangulatePolygon( 00240 vtkIdList *polygon, vtkPoints *points, vtkCellArray *triangles); 00242 00244 00251 void TriangulateContours( 00252 vtkPolyData *data, vtkIdType firstLine, vtkIdType numLines, 00253 vtkCellArray *outputPolys, const double normal[3]); 00255 00257 00261 static void BreakPolylines( 00262 vtkCellArray *inputLines, vtkCellArray *outputLines, 00263 vtkUnsignedCharArray *inputScalars, vtkIdType firstLineScalar, 00264 vtkUnsignedCharArray *outputScalars, const unsigned char color[3]); 00266 00268 00271 static void CopyPolygons( 00272 vtkCellArray *inputPolys, vtkCellArray *outputPolys, 00273 vtkUnsignedCharArray *inputScalars, vtkIdType firstPolyScalar, 00274 vtkUnsignedCharArray *outputScalars, const unsigned char color[3]); 00276 00278 00280 static void BreakTriangleStrips( 00281 vtkCellArray *inputStrips, vtkCellArray *outputPolys, 00282 vtkUnsignedCharArray *inputScalars, vtkIdType firstStripScalar, 00283 vtkUnsignedCharArray *outputScalars, const unsigned char color[3]); 00285 00287 00290 static void SqueezeOutputPoints( 00291 vtkPolyData *output, vtkPoints *points, vtkPointData *pointData, 00292 int outputPointDataType); 00294 00296 00297 static void CreateColorValues( 00298 const double color1[3], const double color2[3], const double color3[3], 00299 unsigned char colors[3][3]); 00301 00302 private: 00303 vtkClipClosedSurface(const vtkClipClosedSurface&); // Not implemented. 00304 void operator=(const vtkClipClosedSurface&); // Not implemented. 00305 }; 00306 00307 #endif