| 173 | } |
| 174 | |
| 175 | bool fromSameTriangle( const MeshTopology & topology, MeshTriPoint & a, MeshTriPoint & b ) |
| 176 | { |
| 177 | if ( auto av = a.inVertex( topology ) ) |
| 178 | { |
| 179 | if ( auto bv = b.inVertex( topology ) ) |
| 180 | { |
| 181 | // a in vertex, b in vertex |
| 182 | if ( av == bv ) |
| 183 | { |
| 184 | a = b = MeshTriPoint( topology.edgeWithOrg( av ), { 0, 0 } ); |
| 185 | return true; |
| 186 | } |
| 187 | if ( auto e = topology.findEdge( av, bv ) ) |
| 188 | { |
| 189 | a = MeshTriPoint( e, { 0, 0 } ); |
| 190 | b = MeshTriPoint( e, { 1, 0 } ); |
| 191 | return true; |
| 192 | } |
| 193 | return false; |
| 194 | } |
| 195 | if ( auto be = b.onEdge( topology ) ) |
| 196 | { |
| 197 | // a in vertex, b on edge |
| 198 | return vertEdge2MeshTriPoints( topology, av, be, a, b ); |
| 199 | } |
| 200 | // a in vertex, b in triangle |
| 201 | if ( auto mtp = getVertexAsMeshTriPoint( topology, b.e, av ) ) |
| 202 | { |
| 203 | a = mtp; |
| 204 | return true; |
| 205 | } |
| 206 | return false; |
| 207 | } |
| 208 | if ( auto ae = a.onEdge( topology ) ) |
| 209 | { |
| 210 | if ( auto bv = b.inVertex( topology ) ) |
| 211 | { |
| 212 | // a on edge, b in vertex |
| 213 | return vertEdge2MeshTriPoints( topology, bv, ae, b, a ); |
| 214 | } |
| 215 | if ( auto be = b.onEdge( topology ) ) |
| 216 | { |
| 217 | // a on edge, b on edge |
| 218 | const auto al = topology.left( ae.e ); |
| 219 | const auto ar = topology.right( ae.e ); |
| 220 | const auto bl = topology.left( be.e ); |
| 221 | const auto br = topology.right( be.e ); |
| 222 | if ( al && al == bl ) |
| 223 | { |
| 224 | a = MeshTriPoint( ae ); |
| 225 | b = MeshTriPoint( be ); |
| 226 | return true; |
| 227 | } |
| 228 | if ( al && al == br ) |
| 229 | { |
| 230 | a = MeshTriPoint( ae ); |
| 231 | b = MeshTriPoint( be.sym() ); |
| 232 | return true; |
nothing calls this directly
no test coverage detected