libsurf
Programmer's Documentation

meshsections.h (r6227/r5385)
1 
2 /* Copyright (C) 2015 David Eller <david@larosterna.com>
3  *
4  * Commercial License Usage
5  * Licensees holding valid commercial licenses may use this file in accordance
6  * with the terms contained in their respective non-exclusive license agreement.
7  * For further information contact david@larosterna.com .
8  *
9  * GNU General Public License Usage
10  * Alternatively, this file may be used under the terms of the GNU General
11  * Public License version 3.0 as published by the Free Software Foundation and
12  * appearing in the file gpl.txt included in the packaging of this file.
13  */
14 
15 #ifndef SURF_MESHSECTIONS_H
16 #define SURF_MESHSECTIONS_H
17 
18 #include <iosfwd>
19 #include <boost/shared_ptr.hpp>
20 #include <genua/bounds.h>
21 #include "facetree.h"
22 
23 class TriMesh;
24 class Plane;
25 
31 {
32  public:
33 
35  MeshSections(const TriMesh & m);
36 
38  uint findPolygons(const Plane & pln);
39 
41  uint npolygons() const {return pgs.size();}
42 
44  Real area(const Plane & pln) const;
45 
47  void areaDistribution(Real alpha, int n, Matrix & xa);
48 
50  void joinPolygons(Real tol = gmepsilon);
51 
53  const PointList<3> & polygon(int i) const {return pgs[i];}
54 
56  void addViz(MeshFields & mvz) const;
57 
59  void writePlain(std::ostream & os) const;
60 
61  private:
62 
64  void triangleFromPlane(const Plane & pln);
65 
67  bool fintersect(uint ti, Vct3 & ps, Vct3 & pt) const;
68 
70  uint newPolygon(Indices & tix);
71 
73  uint nextTriangle(uint ti, Indices & tix,
74  const Vct3 & plast, Vct3 & pnext) const;
75 
76  private:
77 
79  const TriMesh & msh;
80 
83 
86 
88  Vct3 ptri[3];
89 
91  std::vector<PointList<3> > pgs;
92 };
93 
94 typedef boost::shared_ptr<MeshSections> MeshSectionsPtr;
95 
96 #endif
BndBox bb
bounding box of the complete mesh
Definition: meshsections.h:85
MeshSections(const TriMesh &m)
initialize section generator with mesh
Definition: meshsections.cpp:23
uint nextTriangle(uint ti, Indices &tix, const Vct3 &plast, Vct3 &pnext) const
find next triangle of candidates
Definition: meshsections.cpp:118
const PointList< 3 > & polygon(int i) const
access point set for polygon i
Definition: meshsections.h:53
Compute slices through a triangular surface mesh.
Definition: meshsections.h:30
void addViz(MeshFields &mvz) const
add polygons to visu
Definition: meshsections.cpp:179
Real area(const Plane &pln) const
compute area of all polygons
Definition: meshsections.cpp:163
void triangleFromPlane(const Plane &pln)
construct triangle from plane
Definition: meshsections.cpp:29
void areaDistribution(Real alpha, int n, Matrix &xa)
convenience function: area from n slices
Definition: meshsections.cpp:189
bool fintersect(uint ti, Vct3 &ps, Vct3 &pt) const
test for intersection
Definition: meshsections.cpp:46
void joinPolygons(Real tol=gmepsilon)
join multiple open polygons if possible
Definition: meshsections.cpp:232
void writePlain(std::ostream &os) const
write sections to plain text file
Definition: meshsections.cpp:221
uint npolygons() const
number of current polygons
Definition: meshsections.h:41
Vct3 ptri[3]
current triangle vertices
Definition: meshsections.h:88
std::vector< PointList< 3 > > pgs
polygons identified
Definition: meshsections.h:91
const TriMesh & msh
reference to mesh
Definition: meshsections.h:79
Binary tree for triangles.
Definition: facetree.h:38
uint findPolygons(const Plane &pln)
find set of polygons
Definition: meshsections.cpp:62
uint newPolygon(Indices &tix)
start new polygon from scratch
Definition: meshsections.cpp:94
FaceTree ftree
tree used to quickly find intersection candidates
Definition: meshsections.h:82
Generated on Mon Jan 24 2022 03:03:16 for libsurf by   doxygen 1.8.5