MorphoGraphX
2.0-1-227
src
MeshBuilder.hpp
Go to the documentation of this file.
1
#ifndef MeshBuilder_H
2
#define MeshBuilder_H
3
4
#include <
Process.hpp
>
5
#include <
Geometry.hpp
>
6
7
//#include <CellMakerUtils.hpp>
8
9
using namespace
std;
10
11
// MeshBuilder
12
namespace
mgx
13
{
14
15
class
mgxBase_EXPORT
MeshBuilder
16
{
17
public
:
18
19
double
Epsilon
;
20
21
// point to pos in pVec map
22
std::map<Point3d, int>
pMap
;
23
24
// vector of points
25
std::vector<Point3d>
pVec
;
26
27
// vector of tris
28
std::vector<Point3i>
triVec
;
29
30
// vector of vtxs (needs to be created using writeVertexVec if points were only added by position)
31
std::vector<vertex>
vtxVec
;
32
33
// saves labels
34
std::map<int, int>
vertexLabelMap
;
35
std::vector<int>
vertexLabels
;
36
37
MeshBuilder
() { Epsilon = 1E-8; }
38
MeshBuilder
(
double
eps) : Epsilon(eps) {}
39
40
// get the idx of vertex in vtxVec (using the pMap)
41
// if it doesnt exist yet add it to vtxVec
42
int
getIndex(
const
vertex
& v);
43
44
// get the idx of point pos in pVec (using the pMap), assigning the label to the point if its new
45
// if it doesnt exist yet add it to pVec
46
int
getIndex(
Point3d
pos,
int
label = 0);
47
48
// add triangle vertex based (keep vertices)
49
void
addTri(
const
vertex
&a,
const
vertex
&b,
const
vertex
&c,
bool
keepAll =
false
);
50
51
// add tri point based (merge nearby points & save in pMap)
52
//void addTri(const Point3d &a, const Point3d &b, const Point3d &c);
53
54
// add tri point based (merge nearby points & save in pMap), with label for the 3 points
55
void
addTri(
const
Point3d
&a,
const
Point3d
&b,
const
Point3d
&c,
Point3i
label =
Point3i
(0,0,0));
56
57
// add tri with check of which side is heading up and adjusting towards a given normal
58
void
addTriCheckOrient(
const
vertex
&a,
const
vertex
&b,
const
vertex
&c,
Point3d
&
nrml
,
bool
keepAll =
false
);
59
60
// create the vtxVec from the pVec
61
// parameters determine the vertex labels
62
void
writeVertexVec(
bool
useLabelMap,
int
label = 0);
63
void
writeVertexVec(std::map<Point3d, int> pointLabelMap);
64
65
// merge vtxVec and triVec with the ones from another MeshBuilder object
66
void
addToVec(
MeshBuilder
mb);
67
68
void
eraseSmallComponents();
69
70
void
eraseIdenticalTris();
71
72
void
correctOrientationsComponent(std::vector<Point3i>& tris);
73
74
};
75
76
77
}
78
#endif
Process.hpp
mgx::MeshBuilder::Epsilon
double Epsilon
Definition:
MeshBuilder.hpp:19
mgx::MeshBuilder
Definition:
MeshBuilder.hpp:15
Geometry.hpp
mgx
Distributed matrix library.
Definition:
Assert.hpp:26
mgx::MeshBuilder::vertexLabelMap
std::map< int, int > vertexLabelMap
Definition:
MeshBuilder.hpp:34
mgx::nrml
nrml
Definition:
Geometry.hpp:240
mgx::MeshBuilder::pMap
std::map< Point3d, int > pMap
Definition:
MeshBuilder.hpp:22
mgx::MeshBuilder::vertexLabels
std::vector< int > vertexLabels
Definition:
MeshBuilder.hpp:35
mgx::MeshBuilder::triVec
std::vector< Point3i > triVec
Definition:
MeshBuilder.hpp:28
mgx::Vector< 3, double >
mgx::MeshBuilder::MeshBuilder
MeshBuilder()
Definition:
MeshBuilder.hpp:37
mgx::Point3i
Vector< 3, int > Point3i
Definition:
Geometry.hpp:68
mgx::MeshBuilder::vtxVec
std::vector< vertex > vtxVec
Definition:
MeshBuilder.hpp:31
mgx::MeshBuilder::pVec
std::vector< Point3d > pVec
Definition:
MeshBuilder.hpp:25
mgx::MeshBuilder::MeshBuilder
MeshBuilder(double eps)
Definition:
MeshBuilder.hpp:38
mgx::Vertex
Definition:
Vertex.hpp:58
Generated on Fri Jul 9 2021 18:34:54 for MorphoGraphX by
1.8.17