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 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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   vtkIdType VertexId;
00104   // Dimension is supposed to be a flag representing the dimension of the cells
00105   // contributing to the quadric. Lines: 1, Triangles: 2 (and points 0 in the future?)
00106   unsigned char Dimension;
00107   float Quadric[9];
00108 } VTK_POINT_QUADRIC;
00109 
00110 class VTK_GRAPHICS_EXPORT vtkQuadricClustering : public vtkPolyDataToPolyDataFilter
00111 {
00112 public:
00113   vtkTypeMacro(vtkQuadricClustering, vtkPolyDataToPolyDataFilter);
00114   void PrintSelf(ostream& os, vtkIndent indent);
00115   static vtkQuadricClustering *New();
00116 
00118 
00122   vtkSetMacro(UseFeatureEdges, int);
00123   vtkGetMacro(UseFeatureEdges, int);
00124   vtkBooleanMacro(UseFeatureEdges, int);
00125   vtkFeatureEdges *GetFeatureEdges() {return this->FeatureEdges;}
00127 
00129 
00134   vtkSetMacro(UseFeaturePoints, int);
00135   vtkGetMacro(UseFeaturePoints, int);
00136   vtkBooleanMacro(UseFeaturePoints, int);
00138 
00140 
00142   vtkSetClampMacro(FeaturePointsAngle, float, 0.0, 180.0);
00143   vtkGetMacro(FeaturePointsAngle, float);
00145   
00147 
00150   void SetNumberOfXDivisions(int num);
00151   void SetNumberOfYDivisions(int num);
00152   void SetNumberOfZDivisions(int num);
00153   vtkGetMacro(NumberOfXDivisions, int);
00154   vtkGetMacro(NumberOfYDivisions, int);
00155   vtkGetMacro(NumberOfZDivisions, int);
00156   void SetNumberOfDivisions(int div[3]);
00157   int *GetNumberOfDivisions();
00158   void GetNumberOfDivisions(int div[3]);
00160 
00162 
00165   void SetDivisionOrigin(float x, float y, float z);
00166   void SetDivisionOrigin(float o[3]) {this->SetDivisionOrigin(o[0],o[1],o[2]);}
00167   vtkGetVector3Macro(DivisionOrigin, float);
00168   void SetDivisionSpacing(float x, float y, float z);
00169   void SetDivisionSpacing(float s[3]) {this->SetDivisionSpacing(s[0],s[1],s[2]);}
00170   vtkGetVector3Macro(DivisionSpacing, float);
00172 
00174 
00178   vtkSetMacro(UseInternalTriangles, int);
00179   vtkGetMacro(UseInternalTriangles, int);
00180   vtkBooleanMacro(UseInternalTriangles, int);
00182 
00184 
00189   vtkSetMacro(UseInputPoints, int);
00190   vtkGetMacro(UseInputPoints, int);
00191   vtkBooleanMacro(UseInputPoints, int);
00193 
00195 
00199   void StartAppend(float *bounds);
00200   void StartAppend(float x0,float x1,float y0,float y1,float z0,float z1)
00201     {float b[6]; b[0]=x0; b[1]=x1; b[2]=y0; b[3]=y1; b[4]=z0; b[5]=z1; 
00202     this->StartAppend(b);}  
00203   void Append(vtkPolyData *piece);
00204   void EndAppend();
00206 
00208 
00212   vtkSetMacro(CopyCellData, int); 
00213   vtkGetMacro(CopyCellData, int); 
00214   vtkBooleanMacro(CopyCellData, int); 
00216 
00219 protected:
00220   vtkQuadricClustering();
00221   ~vtkQuadricClustering();
00222 
00223   void Execute();
00224     
00226   vtkIdType HashPoint(float point[3]);
00227   
00229 
00230   void ComputeRepresentativePoint(float quadric[9], vtkIdType binId,
00231                                   float point[3]);
00233 
00235 
00237   void AddTriangles(vtkCellArray *tris, vtkPoints *points,
00238                     int geometryFlag);
00239   void AddPolygons(vtkCellArray *polys, vtkPoints *points,
00240                    int geometryFlag);
00241   void AddTriangle(vtkIdType *binIds, float *pt0, float *pt1, float *pt2,
00242                    int geometeryFlag);
00244 
00246 
00248   void AddEdges(vtkCellArray *edges, vtkPoints *points,
00249                 int geometryFlag);
00250   void AddEdge(vtkIdType *binIds, float *pt0, float *pt1, int geometeryFlag);
00252 
00254 
00256   void AddVertices(vtkCellArray *verts, vtkPoints *points, int geometryFlag);
00257   void AddVertex(vtkIdType binId, float *pt, int geometryFlag);
00259 
00261   void InitializeQuadric(float quadric[9]);
00262   
00264   void AddQuadric(vtkIdType binId, float quadric[9]);
00265 
00270   void FindFeaturePoints(vtkCellArray *edges, vtkPoints *edgePts, float angle);
00271   
00273 
00275   void EndAppendUsingPoints(vtkPolyData *input);
00276   int UseInputPoints;
00278 
00281   void EndAppendVertexGeometry(vtkPolyData *input);
00282 
00283   // Unfinished option to handle boundary edges differently.
00284   void AppendFeatureQuadrics(vtkPolyData *pd);
00285   int UseFeatureEdges;
00286   int UseFeaturePoints;
00287   int UseInternalTriangles;
00288 
00289   int NumberOfXDivisions;
00290   int NumberOfYDivisions;
00291   int NumberOfZDivisions;
00292 
00293   // Since there are two was of specifing the grid, we have this flag
00294   // to indicate which the user has set.  When this flag is on, 
00295   // the bin sizes are computed from the DivisionOrigin and DivisionSpacing. 
00296   int ComputeNumberOfDivisions;
00297 
00298   float DivisionOrigin[3];
00299   float DivisionSpacing[3];
00300 
00301   float Bounds[6];
00302   float XBinSize;
00303   float YBinSize;
00304   float ZBinSize;
00305   VTK_POINT_QUADRIC* QuadricArray;
00306   vtkIdType NumberOfBinsUsed;
00307 
00308   // Have to make these instance variables if we are going to allow
00309   // the algorithm to be driven by the Append methods.
00310   vtkCellArray *OutputTriangleArray;
00311   vtkCellArray *OutputLines;
00312 
00313   vtkFeatureEdges *FeatureEdges;
00314   vtkPoints *FeaturePoints;
00315   float FeaturePointsAngle;
00316 
00317   int CopyCellData;
00318   int InCellCount;
00319   int OutCellCount;
00320 private:
00321   vtkQuadricClustering(const vtkQuadricClustering&);  // Not implemented.
00322   void operator=(const vtkQuadricClustering&);  // Not implemented.
00323 };
00324 
00325 #endif

Generated on Thu Mar 28 14:19:22 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001