TetGenProcess
The GeMA wrapper plugin to the TetGen mesh generator
Loading...
Searching...
No Matches
gmpTetGenBuildGroups.h
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_PLUGIN_TETGEN_BUILDGROUPS_H_
25#define _GEMA_PLUGIN_TETGEN_BUILDGROUPS_H_
26
27#include <vector>
28class GmCellMesh;
29class GmValueAccessor;
30class GmCellAccessor;
31
32/*
33* Group cells into volumes based on the surfaces received.
34* It uses a flood fill approach, so surfaces must be 'closed enough' to form
35* volumes in the given grid discretization and bounding box.
36* Also tries to group similar volumes together
37* based on their intersection histogram if groupThreshold is set to a value > 0
38*
39 Given a mesh:
40 - mpoints: list of mesh points (x1,y1,z1,x2,y2,z2,...)
41 - mcells: list of mesh cell connectivity (n1_1, n1_2, n1_3, n1_4, n2_1, n2_2, n2_3, n2_4,...)
42 - mcellSize: list of cell sizes (number of nodes per cell, e.g. 4 for tetrahedra)
43 Set of triangle surfaces forming volumes:
44 - surfPoints: list of surface points (S1_points, S2_points, ...), points = (x1,y1,z1,x2,y2,z2,...)
45 - surfTri: list of surface triangle connectivity (S1_triangles, S2_triangles, ...), triangles = (n1_1, n1_2, n1_3, n2_1, n2_2, n2_3,...)
46 - surfPCount: list of surface points count (number of points in each surfPoints entry)
47 - surfTCount: list of surface triangle count (number of triangles in each surfTri entry)
48 Bounding box:
49 - bmin: minimum coordinates of the bounding box (x_min, y_min, z_min)
50 - bmax: maximum coordinates of the bounding box (x_max, y_max, z_max)
51 Segmentation/Grouping parameters:
52 - groupThreshold: minimum percentage of grid intersections in a volume to be not ignored (remove outliers)
53 - gridRes: resolution of the grid used for flood fill (e.g. number of cells along the longest dimension of the bounding box)
54
55 Returns a tuple with:
56 - Element classes (segmentation)
57 - Grouping; for each class 'i', group[i] is what other class it groups to
58*/
59std::tuple < std::vector<int>, std::vector<int>>
60 buildGroups(const std::vector<double>& mpoints, const std::vector<int>& mcells, const std::vector<int>& mcellSize,
61 const std::vector<std::vector<double>>& surfPoints, const std::vector<std::vector<int>>& surfTri,
62 double bmin[3], double bmax[3], double groupThreshold, int gridRes[3]);
63
64/*
65 Build groups and set directly as a mesh property
66 - Mesh: mesh to build groups
67 - propAc: cell property accessor to set the group property
68*/
69std::tuple < std::vector<int>, std::vector<int>>
70 buildGroups(GmCellMesh* mesh, GmCellAccessor* propAc, GmValueAccessor* coordAc,
71 const std::vector<std::vector<double>>& surfPoints, const std::vector<std::vector<int>>& surfTri,
72 double bmin[3], double bmax[3], double groupThreshold, int gridRes[3]);
73
74#endif