MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / cutAlongEdgeLoop

Function cutAlongEdgeLoop

source/MRMesh/MRContoursStitch.cpp:50–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50EdgeLoop cutAlongEdgeLoop( MeshTopology & topology, const EdgeLoop & c0 )
51{
52 EdgePath c1;
53 if ( !isEdgeLoop( topology, c0 ) )
54 {
55 assert( false );
56 return c1;
57 }
58 const auto sz = c0.size();
59 c1.reserve( sz );
60
61 EdgeId last0 = c0.back().sym();
62
63 // introduce multiple edge for each edge from c0
64 for ( size_t i = 0; i < sz; ++i )
65 {
66 const auto e0 = c0[i];
67 const auto e1 = topology.makeEdge();
68 c1.push_back( e1 );
69 topology.splice( e0, e1 );
70 topology.splice( topology.prev( e0.sym() ), e1.sym() );
71 assert( topology.fromSameOriginRing( e0, e1 ) );
72 assert( topology.fromSameOriginRing( e0.sym(), e1.sym() ) );
73 assert( !topology.left( e0 ) );
74 assert( !topology.right( e1 ) );
75 }
76
77 // split vertices
78 for ( size_t i = 0; i < sz; ++i )
79 {
80 auto e0 = c0[i];
81 assert( !topology.left( e0 ) );
82 auto e1 = c1[i];
83 assert( !topology.right( e1 ) );
84 assert( e0 != e1 );
85
86 assert( topology.fromSameOriginRing( e0, e1 ) );
87 assert( topology.fromSameOriginRing( e0, last0 ) );
88 topology.splice( e0, topology.prev( last0 ) );
89 assert( !topology.fromSameOriginRing( e0, e1 ) );
90 if ( topology.org( e0 ) )
91 topology.setOrg( e1, topology.addVertId() );
92 last0 = e0.sym();
93 }
94
95 assert( isEdgePath( topology, c1 ) );
96 return c1;
97}
98
99EdgeLoop cutAlongEdgeLoop( Mesh& mesh, const EdgeLoop& c0 )
100{

Callers 3

TESTFunction · 0.85
selfBooleanFunction · 0.85

Calls 15

isEdgeLoopFunction · 0.85
isEdgePathFunction · 0.85
push_backMethod · 0.80
fromSameOriginRingMethod · 0.80
leftMethod · 0.80
rightMethod · 0.80
sizeMethod · 0.45
reserveMethod · 0.45
symMethod · 0.45
makeEdgeMethod · 0.45
spliceMethod · 0.45
prevMethod · 0.45

Tested by 1

TESTFunction · 0.68