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

Function fromSameTriangle

source/MRMesh/MREdgePoint.cpp:109–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109bool fromSameTriangle( const MeshTopology & topology, EdgePoint & a, EdgePoint & b )
110{
111 if ( auto av = a.inVertex( topology ) )
112 {
113 if ( auto bv = b.inVertex( topology ) )
114 {
115 // a in vertex, b in vertex
116 if ( av == bv )
117 {
118 a = b = EdgePoint( topology.edgeWithOrg( av ), 0 );
119 return true;
120 }
121 if ( auto e = topology.findEdge( av, bv ) )
122 {
123 a = EdgePoint( e, 0 );
124 b = EdgePoint( e, 1 );
125 return true;
126 }
127 return false;
128 }
129 // a in vertex, b on edge
130 return vertEdge2MeshEdgePoints( topology, av, a, b );
131 }
132 if ( auto bv = b.inVertex( topology ) )
133 {
134 // a on edge, b in vertex
135 return vertEdge2MeshEdgePoints( topology, bv, b, a );
136 }
137 // a on edge, b on edge
138 const auto al = topology.left( a.e );
139 const auto ar = topology.right( a.e );
140 const auto bl = topology.left( b.e );
141 const auto br = topology.right( b.e );
142 if ( al && al == bl )
143 {
144 return true;
145 }
146 if ( al && al == br )
147 {
148 b = b.sym();
149 return true;
150 }
151 if ( ar && ar == bl )
152 {
153 a = a.sym();
154 return true;
155 }
156 if ( ar && ar == br )
157 {
158 a = a.sym();
159 b = b.sym();
160 return true;
161 }
162 return false;
163}
164
165} // namespace MR

Callers

nothing calls this directly

Calls 8

EdgePointClass · 0.85
vertEdge2MeshEdgePointsFunction · 0.85
leftMethod · 0.80
rightMethod · 0.80
inVertexMethod · 0.45
edgeWithOrgMethod · 0.45
findEdgeMethod · 0.45
symMethod · 0.45

Tested by

no test coverage detected