feature magic defaults to 1 now
[engrid.git] / src / libengrid / vtkImplicitPolyData.h
blobafab7ff0989b0c3ede6068e821589e018f960ed9
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008-2013 enGits GmbH +
7 // + +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
12 // + +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
17 // + +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 //
23 /*=========================================================================
25 Program: Boolean
26 Module: $RCSfile: vtkImplicitPolyData.h,v $
27 Language: C++
28 Date: $Date: 2003/07/12 11:22:38 $
29 Version: $Revision: 1.1.1.1 $
31 Copyright (c) 2002 Denis Shamonin
32 Section Computational Science
33 University of Amsterdam
34 Kruislaan 403, 1098 SJ Amsterdam
35 the Netherlands
37 E-mail : dshamoni@science.uva.nl
38 URL : http://www.science.uva.nl/~dshamoni/
40 All rights reserved.
42 This software is distributed WITHOUT ANY WARRANTY; without even
43 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
44 PURPOSE. See the above copyright notice for more information.
46 =========================================================================*/
47 // .NAME vtkImplicitPolyData - treat polygons in input as implicit planes
48 // .SECTION Description
49 // vtkImplicitPolyData provides the basis for using arbritrary polygonal data
50 // as an implicit surface, points are evaluated against nearest polygons which
51 // are handled as implicit planes.
52 // vtkImplicitPolyData is a concrete implementation of the abstract class
53 // vtkImplicitFunction.
54 // An internal instance of vtkTriangleFilter is used to filter vertices and
55 // lines out of the input PolyData, and a MYvtkPointLocator is used to find the
56 // nearest triangle to a candidate point.
58 // PLEASE SEND ME YOUR UPDATES, BUG FIXES! at dshamoni@science.uva.nl
60 #ifndef __vtkImplicitPolyData_h
61 #define __vtkImplicitPolyData_h
63 #include <math.h>
64 #include "vtkPolyData.h"
65 #include "vtkImplicitFunction.h"
66 #include "vtkTriangleFilter.h"
67 #include "vtkIdList.h"
69 #define PointLocator vtkPointLocator
70 #include "vtkPointLocator.h"
72 class vtkImplicitPolyData : public vtkImplicitFunction
74 public:
75 static vtkImplicitPolyData *New() {return new vtkImplicitPolyData;};
76 const char *GetClassName() {return "vtkImplicitPolyData";};
77 void PrintSelf(ostream& os, vtkIndent indent);
79 vtkImplicitPolyData();
80 ~vtkImplicitPolyData();
82 // Description:
83 // Return the MTime also considering the Input dependency.
84 unsigned long GetMTime();
86 void SetEvaluateBounds( double eBounds[6] );
88 // Description
89 // Evaluate plane equation of nearest triangle to point x[3].
90 double EvaluateFunction(double x[3]);
92 // Description
93 // Evaluate function gradient of nearest triangle to point x[3].
94 void EvaluateGradient(double x[3], double g[3]);
96 // Description:
97 // Set the input polydata used for the implicit function evaluation.
98 // Passes input through an internal instance of vtkTriangleFilter to remove
99 // vertices and lines, leaving only triangular polygons for evaluation as
100 // implicit planes
101 void SetInput(vtkPolyData *input);
103 // Description:
104 // Set / get the function value to use if no input polydata specified.
105 vtkSetMacro(NoValue,double);
106 vtkGetMacro(NoValue,double);
108 // Description:
109 // Set / get the function gradient to use if no input polydata specified.
110 vtkSetVector3Macro(NoGradient,double);
111 vtkGetVector3Macro(NoGradient,double);
113 vtkSetMacro(Tolerance,double);
114 vtkGetMacro(Tolerance,double);
116 protected:
117 double NoValue;
118 double NoGradient[3];
120 vtkTriangleFilter *tri;
121 vtkPolyData *input;
122 vtkPointLocator *locator;
123 vtkPolygon *poly;
124 vtkIdList *cells;
126 double EvaluateBounds[6];
127 int EvaluateBoundsSet;
128 double Tolerance;
131 #endif