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

Graphics/vtkDelaunay2D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDelaunay2D.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 =========================================================================*/
00160 #ifndef __vtkDelaunay2D_h
00161 #define __vtkDelaunay2D_h
00162 
00163 #include "vtkPointSet.h"
00164 #include "vtkPolyDataSource.h"
00165 #include "vtkAbstractTransform.h"
00166 
00167 class VTK_GRAPHICS_EXPORT vtkDelaunay2D : public vtkPolyDataSource
00168 {
00169 public:
00170   vtkTypeMacro(vtkDelaunay2D,vtkPolyDataSource);
00171   void PrintSelf(ostream& os, vtkIndent indent);
00172 
00175   static vtkDelaunay2D *New();
00176 
00178 
00183   void SetSource(vtkPolyData *);
00184   vtkPolyData *GetSource();
00186   
00188 
00192   vtkSetClampMacro(Alpha,double,0.0,VTK_LARGE_FLOAT);
00193   vtkGetMacro(Alpha,double);
00195 
00197 
00200   vtkSetClampMacro(Tolerance,double,0.0,1.0);
00201   vtkGetMacro(Tolerance,double);
00203 
00205 
00207   vtkSetClampMacro(Offset,double,0.75,VTK_LARGE_FLOAT);
00208   vtkGetMacro(Offset,double);
00210 
00212 
00216   vtkSetMacro(BoundingTriangulation,int);
00217   vtkGetMacro(BoundingTriangulation,int);
00218   vtkBooleanMacro(BoundingTriangulation,int);
00220 
00222 
00223   virtual void SetInput(vtkPointSet *input);
00224   vtkPointSet *GetInput();
00226 
00228 
00236   vtkSetObjectMacro(Transform, vtkAbstractTransform);
00237   vtkGetObjectMacro(Transform, vtkAbstractTransform);
00239 
00240 protected:
00241   vtkDelaunay2D();
00242   ~vtkDelaunay2D();
00243 
00244   void Execute();
00245 
00246   double Alpha;
00247   double Tolerance;
00248   int BoundingTriangulation;
00249   double Offset;
00250 
00251   vtkAbstractTransform *Transform;
00252 
00253 private:
00254   vtkPolyData *Mesh; //the created mesh
00255   double *Points;    //the raw points in double precision
00256   void SetPoint(vtkIdType id, double *x)
00257     {vtkIdType idx=3*id; 
00258     this->Points[idx] = x[0];
00259     this->Points[idx+1] = x[1];
00260     this->Points[idx+2] = x[2];
00261     }
00262       
00263   void GetPoint(vtkIdType id, double x[3])
00264     {double *ptr = this->Points + 3*id;
00265     x[0] = *ptr++;
00266     x[1] = *ptr++;
00267     x[2] = *ptr;
00268     }
00269 
00270   int NumberOfDuplicatePoints;
00271   int NumberOfDegeneracies;
00272 
00273   int *RecoverBoundary();
00274   int RecoverEdge(vtkIdType p1, vtkIdType p2);
00275   void FillPolygons(vtkCellArray *polys, int *triUse);
00276 
00277   int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
00278   vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
00279                          double tol, vtkIdType nei[3], vtkIdList *neighbors);
00280   void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
00281                  vtkIdType tri);
00282 
00283 private:
00284   vtkDelaunay2D(const vtkDelaunay2D&);  // Not implemented.
00285   void operator=(const vtkDelaunay2D&);  // Not implemented.
00286 };
00287 
00288 #endif
00289 
00290 

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