libsurf
Programmer's Documentation

toposegmchain.h (r6227/r5731)
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_TOPOSEGMCHAIN_H
16 #define SURF_TOPOSEGMCHAIN_H
17 
18 #include "forward.h"
19 #include "topoisecsegment.h"
20 #include <genua/connectmap.h>
21 #include <deque>
22 
29 {
30 public:
31 
32  typedef std::deque<uint> IdxChain;
33  typedef std::vector<IdxChain> IdxChainArray;
34 
37 
39  uint extractTopology(const Topology &topo, Real threshold=gmepsilon);
40 
42  uint generateEdge(Topology &topo, uint k) const;
43 
44 private:
45 
47  //void reduce(uint k, Real lmax, Real lmin, Real cosphi);
48 
50  void mergeVertices(Real threshold);
51 
53  int mapSegments();
54 
56  int onBoundary(uint s, uint v) const;
57 
59  Vct2 uvlocation(uint j, uint f) const {
60  ConnectMap::const_iterator itr, last = m_map.end(j);
61  for (itr = m_map.begin(j); itr != last; ++itr) {
62  const TopoIsecSegment &seg( m_segm[*itr] );
63  if (seg.aface() == f) {
64  if (j == seg.source())
65  return seg.asource();
66  else if (j == seg.target())
67  return seg.atarget();
68  } else if (seg.bface() == f) {
69  if (j == seg.source())
70  return seg.bsource();
71  else if (j == seg.target())
72  return seg.btarget();
73  }
74  }
75  assert(!"Failed to locate point, topologically impossible.");
76  return Vct2();
77  }
78 
79 private:
80 
82  TopoIsecArray m_segm;
83 
86 
88  IndexPairArray m_sfp;
89 
91  IdxChainArray m_vchains;
92 
94  IdxChainArray m_schains;
95 
98 };
99 
100 #endif // TOPOSEGMCHAIN_H
const Vct2 & bsource() const
(u,v) source on b
Definition: topoisecsegment.h:57
ConnectMap m_map
maps vertices to segment indices
Definition: toposegmchain.h:97
uint target() const
access source vertex index
Definition: topoisecsegment.h:72
IdxChainArray m_vchains
identified vertex chains
Definition: toposegmchain.h:91
uint generateEdge(Topology &topo, uint k) const
create an edge from chain k
Definition: toposegmchain.cpp:228
const_iterator begin(uint ir) const
TopoSegmChain()
create undefined intersection topology handler
Definition: toposegmchain.h:36
Vct2 uvlocation(uint j, uint f) const
determine (u,v) space point of vertex j on face f
Definition: toposegmchain.h:59
IndexPairArray m_sfp
surface pair for chains
Definition: toposegmchain.h:88
void mergeVertices(Real threshold)
reduce number of points in chain without violating criteria
Definition: toposegmchain.cpp:25
uint extractTopology(const Topology &topo, Real threshold=gmepsilon)
compute connectivity
Definition: toposegmchain.cpp:120
const_iterator end(uint ir) const
int mapSegments()
create a vertex-to-segment mapping
Definition: toposegmchain.cpp:55
uint aface() const
access face index
Definition: topoisecsegment.h:84
IdxChainArray m_schains
identified segment chains
Definition: toposegmchain.h:94
Container for topology information.
Definition: topology.h:30
uint bface() const
access face index
Definition: topoisecsegment.h:87
PointList< 3 > m_vtx
final set of vertices in 3D space
Definition: toposegmchain.h:85
const Vct2 & btarget() const
(u,v) target on b
Definition: topoisecsegment.h:60
const Vct2 & asource() const
(u,v) source on a
Definition: topoisecsegment.h:51
uint source() const
access source vertex index
Definition: topoisecsegment.h:69
const Vct2 & atarget() const
(u,v) target on a
Definition: topoisecsegment.h:54
Indices::const_iterator const_iterator
Intersection segment.
Definition: topoisecsegment.h:30
TopoIsecArray m_segm
intersection segments
Definition: toposegmchain.h:82
int onBoundary(uint s, uint v) const
determine whether a vertex v on segment s is on a (u,v) boundary
Definition: toposegmchain.cpp:96
Chain of intersection segments.
Definition: toposegmchain.h:28
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5