compare intersections of two triangles with one edge along that edge; returns Unknown only if both triangles share the same 3 vertices
| 494 | /// compare intersections of two triangles with one edge along that edge; |
| 495 | /// returns Unknown only if both triangles share the same 3 vertices |
| 496 | CompareResult compareEdgeTrisIntersections( EdgeId intersectedEdge, const Mesh& mesh, const SortIntersectionsData& sortData, |
| 497 | FaceId fl, FaceId fr ) |
| 498 | { |
| 499 | assert( fl != fr ); |
| 500 | |
| 501 | const auto& otherTopology = sortData.otherMesh.topology; |
| 502 | auto vsl = otherTopology.getTriVerts( fl ); |
| 503 | std::sort( vsl.begin(), vsl.end() ); |
| 504 | auto vsr = otherTopology.getTriVerts( fr ); |
| 505 | std::sort( vsr.begin(), vsr.end() ); |
| 506 | if ( vsl == vsr ) |
| 507 | return CompareResult::Unknown; |
| 508 | |
| 509 | VertId vo = mesh.topology.org( intersectedEdge ); |
| 510 | VertId vd = mesh.topology.dest( intersectedEdge ); |
| 511 | |
| 512 | auto po = mesh.points[vo]; |
| 513 | auto pd = mesh.points[vd]; |
| 514 | |
| 515 | if ( sortData.isOtherA ) |
| 516 | { |
| 517 | vo += (int)sortData.meshAVertsNum; |
| 518 | vd += (int)sortData.meshAVertsNum; |
| 519 | if ( sortData.rigidB2A ) |
| 520 | { |
| 521 | po = (*sortData.rigidB2A)( po ); |
| 522 | pd = (*sortData.rigidB2A)( pd ); |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | std::array<PreciseVertCoords, 8> preciseVerts |
| 527 | { |
| 528 | PreciseVertCoords{ vo, sortData.converter( po ) }, |
| 529 | PreciseVertCoords{ vd, sortData.converter( pd ) }, |
| 530 | preciseOtherVert( vsl[0], sortData ), |
| 531 | preciseOtherVert( vsl[1], sortData ), |
| 532 | preciseOtherVert( vsl[2], sortData ), |
| 533 | preciseOtherVert( vsr[0], sortData ), |
| 534 | preciseOtherVert( vsr[1], sortData ), |
| 535 | preciseOtherVert( vsr[2], sortData ) |
| 536 | }; |
| 537 | return segmentIntersectionOrder( preciseVerts ) ? CompareResult::Less : CompareResult::Greater; |
| 538 | } |
| 539 | |
| 540 | /// compare intersections of two triangles with one edge along that edge; |
| 541 | /// if both triangles share the same 3 vertices then goes along the contours to other intersection in hope to resolve the ambiguity |
no test coverage detected