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   int VertexId;
00104   // Dimension is suposed 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_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   // Unfinished option to handle boundary edges differently.
00215   void AppendFeatureQuadrics(vtkPolyData *pd);
00216   int UseFeatureEdges;
00217 
00218   int NumberOfXDivisions;
00219   int NumberOfYDivisions;
00220   int NumberOfZDivisions;
00221 
00222   // Since there are two was of specifing the grid, we have this flag
00223   // to indicate which the user has set.  When this flag is on, 
00224   // the bin sizes are computed from the DivisionOrigin and DivisionSpacing. 
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   // Have to make these instance variables if we are going to allow
00238   // the algorithm to be driven by the Append methods.
00239   vtkCellArray *OutputTriangleArray;
00240   vtkCellArray *OutputLines;
00241   vtkCellArray *OutputVerts;
00242 
00243   vtkFeatureEdges *FeatureEdges;
00244 };
00245 
00246 #endif

Generated on Wed Nov 21 12:27:02 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001