00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00094 #ifndef __vtkQuadricClustering_h
00095 #define __vtkQuadricClustering_h
00096
00097 #include "vtkPolyDataToPolyDataFilter.h"
00098 #include "vtkDataSetCollection.h"
00099
00100 class vtkFeatureEdges;
00101
00102 typedef struct {
00103 int VertexId;
00104
00105
00106 unsigned char Dimension;
00107 float Quadric[9];
00108 } VTK_POINT_QUADRIC;
00109
00110 class VTK_EXPORT vtkQuadricClustering : public vtkPolyDataToPolyDataFilter
00111 {
00112 public:
00113 vtkTypeMacro(vtkQuadricClustering, vtkPolyDataToPolyDataFilter);
00114 void PrintSelf(ostream& os, vtkIndent indent);
00115 static vtkQuadricClustering *New();
00116
00121 vtkSetMacro(UseFeatureEdges, int);
00122 vtkGetMacro(UseFeatureEdges, int);
00123 vtkBooleanMacro(UseFeatureEdges, int);
00124 vtkFeatureEdges *GetFeatureEdges() {return this->FeatureEdges;}
00125
00129 void SetNumberOfXDivisions(int num);
00130 void SetNumberOfYDivisions(int num);
00131 void SetNumberOfZDivisions(int num);
00132 vtkGetMacro(NumberOfXDivisions, int);
00133 vtkGetMacro(NumberOfYDivisions, int);
00134 vtkGetMacro(NumberOfZDivisions, int);
00135 void SetNumberOfDivisions(int div[3]);
00136 int *GetNumberOfDivisions();
00137 void GetNumberOfDivisions(int div[3]);
00138
00142 void SetDivisionOrigin(float x, float y, float z);
00143 void SetDivisionOrigin(float o[3]) {this->SetDivisionOrigin(o[0],o[1],o[2]);}
00144 vtkGetVector3Macro(DivisionOrigin, float);
00145 void SetDivisionSpacing(float x, float y, float z);
00146 void SetDivisionSpacing(float s[3]) {this->SetDivisionSpacing(s[0],s[1],s[2]);}
00147 vtkGetVector3Macro(DivisionSpacing, float);
00148
00154 vtkSetMacro(UseInputPoints, int);
00155 vtkGetMacro(UseInputPoints, int);
00156 vtkBooleanMacro(UseInputPoints, int);
00157
00162 void StartAppend(float *bounds);
00163 void StartAppend(float x0,float x1,float y0,float y1,float z0,float z1)
00164 {float b[6]; b[0]=x0; b[1]=x1; b[2]=y0; b[3]=y1; b[4]=z0; b[5]=z1;
00165 this->StartAppend(b);}
00166 void Append(vtkPolyData *piece);
00167 void EndAppend();
00168
00169 protected:
00170 vtkQuadricClustering();
00171 ~vtkQuadricClustering();
00172 vtkQuadricClustering(const vtkQuadricClustering&) {};
00173 void operator=(const vtkQuadricClustering&) {};
00174
00175 void Execute();
00176
00178 int HashPoint(float point[3]);
00179
00181 void ComputeRepresentativePoint(float quadric[9], int binId,
00182 float point[3]);
00183
00186 void AddTriangles(vtkCellArray *edges, vtkPoints *points,
00187 int geometryFlag);
00188 void AddTriangle(int *binIds, float *pt0, float *pt1, float *pt2,
00189 int geometeryFlag);
00190
00193 void AddEdges(vtkCellArray *edges, vtkPoints *points,
00194 int geometryFlag);
00195 void AddEdge(int *binIds, float *pt0, float *pt1, int geometeryFlag);
00196
00199 void AddVerticies(vtkCellArray *verts, vtkPoints *points,
00200 int geometryFlag);
00201 void AddVertex(int binId, float *pt, int geometeryFlag);
00202
00204 void InitializeQuadric(float quadric[9]);
00205
00207 void AddQuadric(int binId, float quadric[9]);
00208
00211 void EndAppendUsingPoints(vtkPolyData *input);
00212 int UseInputPoints;
00213
00214
00215 void AppendFeatureQuadrics(vtkPolyData *pd);
00216 int UseFeatureEdges;
00217
00218 int NumberOfXDivisions;
00219 int NumberOfYDivisions;
00220 int NumberOfZDivisions;
00221
00222
00223
00224
00225 int ComputeNumberOfDivisions;
00226
00227 float DivisionOrigin[3];
00228 float DivisionSpacing[3];
00229
00230 float Bounds[6];
00231 float XBinSize;
00232 float YBinSize;
00233 float ZBinSize;
00234 VTK_POINT_QUADRIC* QuadricArray;
00235 int NumberOfBinsUsed;
00236
00237
00238
00239 vtkCellArray *OutputTriangleArray;
00240 vtkCellArray *OutputLines;
00241 vtkCellArray *OutputVerts;
00242
00243 vtkFeatureEdges *FeatureEdges;
00244 };
00245
00246 #endif