1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef CREATECADTESSELATION_H
22 #define CREATECADTESSELATION_H
24 #include "operation.h"
25 #include "cadinterface.h"
27 class CreateCadTesselation
: public Operation
30 private: // attributes
45 int m_PreservationType
;
46 double m_SmallestFeatureSize
;
47 double m_SmallestResolution
;
48 double m_TargetReduction
;
50 CadInterface
* m_CadInterface
;
54 virtual void operate();
56 bool shootRay(vec3_t x
, vec3_t v
, vec3_t
&x_in
, vec3_t
&x_out
, vec3_t
&n_in
, vec3_t
&n_out
);
57 void scan(bool create_grid
, int interlaces
= 0);
59 double getx(int i
) { return m_X1
[0] + i
*m_Dx
; }
60 double gety(int j
) { return m_X1
[1] + j
*m_Dy
; }
61 double getz(int k
) { return m_X1
[2] + k
*m_Dz
; }
62 vec3_t
getX(int i
, int j
, int k
) { return vec3_t(getx(i
), gety(j
), getz(k
)); }
63 int getIdx(int i
, int j
, int k
) { return i
+ j
*m_Ni
+ k
*m_Ni
*m_Nj
; }
68 CreateCadTesselation(CadInterface
* cad_interface
);
70 void setScanMemory(double mem
) { m_ScanMemory
= mem
; }
71 void setPreservationOff() { m_PreservationType
= 0; }
72 void setSolidPreservation() { m_PreservationType
= 1; }
73 void setFluidPreservation() { m_PreservationType
= 2; }
74 void setPreservationType(int t
) { m_PreservationType
= t
; }
75 void setSmoothingIterations(int n
) { m_NumIterations
= n
; }
76 bool preserveSolid() { return m_PreservationType
== 1; }
77 bool preserveFluid() { return m_PreservationType
== 2; }
78 void setSmallestFeatureSize(double sfs
) { m_SmallestFeatureSize
= sfs
; }
79 void setSmallestResolution(double h
) { m_SmallestResolution
= h
; }
80 void setTargetReduction(double tr
) { m_TargetReduction
= tr
; }
84 #endif // CREATECADTESSELATION_H