libsurf
Programmer's Documentation

edgefaceisec.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_EDGEFACEISEC_H
16 #define SURF_EDGEFACEISEC_H
17 
18 #include <map>
19 #include <deque>
20 #include <genua/defines.h>
21 #include <genua/triedge.h>
22 #include <genua/triface.h>
23 #include "sides.h"
24 
25 class MeshPatch;
26 
35 {
36  public:
37 
40 
42  EdgeFaceIsec(const TriFace & t, const TriEdge & s);
43 
45  bool operator< (const EdgeFaceIsec & rhs) const;
46 
48  bool valid(bool disjoint = true) const;
49 
51  bool touching(Real threshold = gmepsilon) const;
52 
54  const Vct3 & location() const {return uvt;}
55 
57  Vct3 eval() const;
58 
60  Vct3 midpoint() const;
61 
63  Vct3 tangent() const;
64 
66  Vct2 fparameter() const;
67 
69  Vct2 eparameter() const;
70 
72  Vct2 parameter(const MeshPatch *mp) const;
73 
75  const TriFace & triangle() const {return f;}
76 
78  const TriEdge & segment() const {return e;}
79 
81  Real refine(Real tol, uint maxit = 32);
82 
84  Real erefine(Real tol, uint maxit = 32);
85 
87  Real localSize() const;
88 
90  Real sizeRatio() const;
91 
93  side_t onBoundary(Real tol) const;
94 
96  void forceToBoundary(Real tol);
97 
99  bool fakeOpposedPoint(Real ptol, EdgeFaceIsec & fop) const;
100 
101  private:
102 
105 
107  TriEdge e;
108 
110  Vct3 uvt;
111 
113  bool refined;
114 
116  Vct2 rqe, rqf;
117 
119  Vct3 rpt, rtg;
120 };
121 
122 typedef std::deque<EdgeFaceIsec> IsecLine;
123 typedef std::vector<IsecLine> IsecSet;
124 
125 #if defined(HAVE_TR1)
126 
127 #include <tr1/unordered_map>
128 #include <tr1/unordered_set>
129 
130 typedef std::tr1::unordered_map<TriEdge, std::vector<EdgeFaceIsec>, edge_hash, global_edge_equal> EdgeIsecMap;
131 typedef std::tr1::unordered_map<TriFace, std::vector<EdgeFaceIsec>, face_hash, global_face_equal> FaceIsecMap;
132 typedef std::tr1::unordered_set<TriEdge, edge_hash, global_edge_equal> EdgeSet;
133 
134 #elif defined(HAVE_SGI_STL)
135 
136 #include <ext/hash_map>
137 #include <ext/hash_set>
138 
139 typedef __gnu_cxx::hash_map<TriEdge, std::vector<EdgeFaceIsec>, edge_hash, global_edge_equal> EdgeIsecMap;
140 typedef __gnu_cxx::hash_map<TriFace, std::vector<EdgeFaceIsec>, face_hash, global_face_equal> FaceIsecMap;
141 typedef __gnu_cxx::hash_set<TriEdge, edge_hash, global_edge_equal> EdgeSet;
142 
143 #else
144 
145 #include <map>
146 #include <set>
147 
148 typedef std::map<TriFace, std::vector<EdgeFaceIsec>, global_face_less> FaceIsecMap;
149 typedef std::map<TriEdge, std::vector<EdgeFaceIsec>, global_edge_less> EdgeIsecMap;
150 typedef std::set<TriEdge, global_edge_less> EdgeSet;
151 
152 #endif
153 
154 #endif
155 
Vct2 rqe
parametric positions after refinement
Definition: edgefaceisec.h:116
TriFace f
triangle
Definition: edgefaceisec.h:104
Vct3 uvt
intersection parameter
Definition: edgefaceisec.h:110
Generates the triangulation of a single surface.
Definition: meshpatch.h:61
bool operator<(const EdgeFaceIsec &rhs) const
required to use sets and maps with this class
Definition: edgefaceisec.cpp:32
bool fakeOpposedPoint(Real ptol, EdgeFaceIsec &fop) const
generate fake intersection point on the opposite side of a u-seam
Definition: edgefaceisec.cpp:498
Vct2 eparameter() const
edge parameter (u,v)
Definition: edgefaceisec.cpp:145
Vct2 fparameter() const
face parameters (u,v)
Definition: edgefaceisec.cpp:126
const TriEdge & segment() const
access edge
Definition: edgefaceisec.h:78
EdgeFaceIsec()
create undefined intersection point
Definition: edgefaceisec.h:39
Intersection between edge and triangular face.
Definition: edgefaceisec.h:34
const Vct3 & location() const
return the intersection parameters (face/edge flat geometry)
Definition: edgefaceisec.h:54
const TriFace & triangle() const
access triangle
Definition: edgefaceisec.h:75
side_t onBoundary(Real tol) const
check if any of the points is on an edge
Definition: edgefaceisec.cpp:467
bool valid(bool disjoint=true) const
check if intersection point lies within triangle and edge
Definition: edgefaceisec.cpp:54
Real refine(Real tol, uint maxit=32)
apply iterative refinement, return resulting gap
Definition: edgefaceisec.cpp:246
Real localSize() const
compute local feature size
Definition: edgefaceisec.cpp:421
void forceToBoundary(Real tol)
if point is closer than tol to boundary, force it upon it
Definition: edgefaceisec.cpp:477
Vct3 tangent() const
tangent to intersection line
Definition: edgefaceisec.cpp:160
Real sizeRatio() const
compute size ratio (mean triangle edge length over edge length)
Definition: edgefaceisec.cpp:447
TriEdge e
segment
Definition: edgefaceisec.h:107
Vct3 eval() const
compute corresponding 3D point on the discrete surfaces
Definition: edgefaceisec.cpp:115
bool touching(Real threshold=gmepsilon) const
check if intersection is on an edge/vertex
Definition: edgefaceisec.cpp:98
bool refined
flag indicating if iterative refinement is performed
Definition: edgefaceisec.h:113
Vct3 rpt
position and tangent after refinement
Definition: edgefaceisec.h:119
Vct3 midpoint() const
compute 3D point averaged between smooth surfaces
Definition: edgefaceisec.cpp:220
Real erefine(Real tol, uint maxit=32)
try to refine using Newton&#39;s method
Definition: edgefaceisec.cpp:289
Vct2 parameter(const MeshPatch *mp) const
pick right parameter pair
Definition: edgefaceisec.cpp:201
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5