Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Graphics/vtkQuadricClustering.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkQuadricClustering.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00084 #ifndef __vtkQuadricClustering_h
    00085 #define __vtkQuadricClustering_h
    00086
    00087 #include "vtkPolyDataToPolyDataFilter.h"
    00088
    00089 class vtkCellArray;
    00090 class vtkFeatureEdges;
    00091 class vtkPoints;
    00092
    00093 class VTK_GRAPHICS_EXPORT vtkQuadricClustering : public vtkPolyDataToPolyDataFilter
    00094 {
    00095 public:
    00096   vtkTypeRevisionMacro(vtkQuadricClustering, vtkPolyDataToPolyDataFilter);
    00097   void PrintSelf(ostream& os, vtkIndent indent);
    00098   static vtkQuadricClustering *New();
    00099
    00101
    00105   vtkSetMacro(UseFeatureEdges, int);
    00106   vtkGetMacro(UseFeatureEdges, int);
    00107   vtkBooleanMacro(UseFeatureEdges, int);
    00108   vtkFeatureEdges *GetFeatureEdges() {return this->FeatureEdges;}
    00110
    00112
    00117   vtkSetMacro(UseFeaturePoints, int);
    00118   vtkGetMacro(UseFeaturePoints, int);
    00119   vtkBooleanMacro(UseFeaturePoints, int);
    00121
    00123
    00125   vtkSetClampMacro(FeaturePointsAngle, float, 0.0, 180.0);
    00126   vtkGetMacro(FeaturePointsAngle, float);
    00128
    00130
    00134   void SetNumberOfXDivisions(int num);
    00135   void SetNumberOfYDivisions(int num);
    00136   void SetNumberOfZDivisions(int num);
    00137   vtkGetMacro(NumberOfXDivisions, int);
    00138   vtkGetMacro(NumberOfYDivisions, int);
    00139   vtkGetMacro(NumberOfZDivisions, int);
    00140   void SetNumberOfDivisions(int div[3]);
    00141   int *GetNumberOfDivisions();
    00142   void GetNumberOfDivisions(int div[3]);
    00144
    00146
    00149   void SetDivisionOrigin(float x, float y, float z);
    00150   void SetDivisionOrigin(float o[3]) {this->SetDivisionOrigin(o[0],o[1],o[2]);}
    00151   vtkGetVector3Macro(DivisionOrigin, float);
    00152   void SetDivisionSpacing(float x, float y, float z);
    00153   void SetDivisionSpacing(float s[3]) {this->SetDivisionSpacing(s[0],s[1],s[2]);}
    00154   vtkGetVector3Macro(DivisionSpacing, float);
    00156
    00158
    00162   vtkSetMacro(UseInternalTriangles, int);
    00163   vtkGetMacro(UseInternalTriangles, int);
    00164   vtkBooleanMacro(UseInternalTriangles, int);
    00166
    00168
    00173   vtkSetMacro(UseInputPoints, int);
    00174   vtkGetMacro(UseInputPoints, int);
    00175   vtkBooleanMacro(UseInputPoints, int);
    00177
    00179
    00183   void StartAppend(float *bounds);
    00184   void StartAppend(float x0,float x1,float y0,float y1,float z0,float z1)
    00185     {float b[6]; b[0]=x0; b[1]=x1; b[2]=y0; b[3]=y1; b[4]=z0; b[5]=z1;
    00186     this->StartAppend(b);}
    00187   void Append(vtkPolyData *piece);
    00188   void EndAppend();
    00190
    00192
    00196   vtkSetMacro(CopyCellData, int);
    00197   vtkGetMacro(CopyCellData, int);
    00198   vtkBooleanMacro(CopyCellData, int);
    00200
    00203 protected:
    00204   vtkQuadricClustering();
    00205   ~vtkQuadricClustering();
    00206
    00207   void Execute();
    00208
    00210   vtkIdType HashPoint(float point[3]);
    00211
    00213
    00214   void ComputeRepresentativePoint(float quadric[9], vtkIdType binId,
    00215                                   float point[3]);
    00217
    00219
    00221   void AddTriangles(vtkCellArray *tris, vtkPoints *points,
    00222                     int geometryFlag);
    00223   void AddPolygons(vtkCellArray *polys, vtkPoints *points,
    00224                    int geometryFlag);
    00225   void AddTriangle(vtkIdType *binIds, float *pt0, float *pt1, float *pt2,
    00226                    int geometeryFlag);
    00228
    00230
    00232   void AddEdges(vtkCellArray *edges, vtkPoints *points,
    00233                 int geometryFlag);
    00234   void AddEdge(vtkIdType *binIds, float *pt0, float *pt1, int geometeryFlag);
    00236
    00238
    00240   void AddVertices(vtkCellArray *verts, vtkPoints *points, int geometryFlag);
    00241   void AddVertex(vtkIdType binId, float *pt, int geometryFlag);
    00243
    00245   void InitializeQuadric(float quadric[9]);
    00246
    00248   void AddQuadric(vtkIdType binId, float quadric[9]);
    00249
    00254   void FindFeaturePoints(vtkCellArray *edges, vtkPoints *edgePts, float angle);
    00255
    00257
    00259   void EndAppendUsingPoints(vtkPolyData *input);
    00260   int UseInputPoints;
    00262
    00265   void EndAppendVertexGeometry(vtkPolyData *input);
    00266
    00267   // Unfinished option to handle boundary edges differently.
    00268   void AppendFeatureQuadrics(vtkPolyData *pd);
    00269   int UseFeatureEdges;
    00270   int UseFeaturePoints;
    00271   int UseInternalTriangles;
    00272
    00273   int NumberOfXDivisions;
    00274   int NumberOfYDivisions;
    00275   int NumberOfZDivisions;
    00276
    00277   // Used internally.
    00278   // can be smaller than user values when input numb er of points is small.
    00279   int NumberOfDivisions[3];
    00280
    00281   // Since there are two was of specifing the grid, we have this flag
    00282   // to indicate which the user has set.  When this flag is on,
    00283   // the bin sizes are computed from the DivisionOrigin and DivisionSpacing.
    00284   int ComputeNumberOfDivisions;
    00285
    00286   float DivisionOrigin[3];
    00287   float DivisionSpacing[3];
    00288
    00289   float Bounds[6];
    00290   float XBinSize;
    00291   float YBinSize;
    00292   float ZBinSize;
    00293
    00294   //BTX
    00295   class PointQuadric
    00296   {
    00297   public:
    00298     vtkIdType VertexId;
    00299     // Dimension is supposed to be a flag representing the dimension of the cells
    00300     // contributing to the quadric.
    00301     // Lines: 1, Triangles: 2 (and points 0 in the future?)
    00302     unsigned char Dimension;
    00303     float Quadric[9];
    00304   };
    00305   //ETX
    00306   PointQuadric* QuadricArray;
    00307
    00308   vtkIdType NumberOfBinsUsed;
    00309
    00310   // Have to make these instance variables if we are going to allow
    00311   // the algorithm to be driven by the Append methods.
    00312   vtkCellArray *OutputTriangleArray;
    00313   vtkCellArray *OutputLines;
    00314
    00315   vtkFeatureEdges *FeatureEdges;
    00316   vtkPoints *FeaturePoints;
    00317   float FeaturePointsAngle;
    00318
    00319   int CopyCellData;
    00320   int InCellCount;
    00321   int OutCellCount;
    00322 private:
    00323   vtkQuadricClustering(const vtkQuadricClustering&);  // Not implemented.
    00324   void operator=(const vtkQuadricClustering&);  // Not implemented.
    00325 };
    00326
    00327 #endif