| 10 | { |
| 11 | |
| 12 | TEST( MRMesh, BooleanIntersectionsSort ) |
| 13 | { |
| 14 | Mesh meshA; |
| 15 | meshA.points = std::vector<Vector3f> |
| 16 | { |
| 17 | { 8.95297337f, 14.3548975f,-0.212119192f }, |
| 18 | { 8.98828983f, 14.3914976f,-0.198161319f }, |
| 19 | { 8.92162418f, 14.4169340f,-0.203402281f }, |
| 20 | { 8.95297337f, 14.4501600f,-0.191835344f } |
| 21 | }; |
| 22 | Triangulation tA = |
| 23 | { |
| 24 | { 0_v, 1_v, 3_v }, |
| 25 | { 0_v, 3_v, 2_v } |
| 26 | }; |
| 27 | meshA.topology = MeshBuilder::fromTriangles( tA ); |
| 28 | |
| 29 | Mesh meshB; |
| 30 | meshB.points = std::vector<Vector3f> |
| 31 | { |
| 32 | { 8.91892719f, 14.3419390f, -0.208497435f }, |
| 33 | { 8.99423218f, 14.4023476f, -0.208966389f }, |
| 34 | { 9.00031281f, 14.4126110f, -0.209267750f }, |
| 35 | { 8.99934673f, 14.4161797f, -0.209171638f }, |
| 36 | { 8.91623878f, 14.3510427f, -0.205425277f } |
| 37 | }; |
| 38 | Triangulation tB = |
| 39 | { |
| 40 | { 0_v, 1_v, 2_v }, |
| 41 | { 0_v, 2_v, 4_v }, |
| 42 | { 2_v, 3_v, 4_v } |
| 43 | }; |
| 44 | meshB.topology = MeshBuilder::fromTriangles( tB ); |
| 45 | auto converters = getVectorConverters( meshA, meshB ); |
| 46 | auto intersections = findCollidingEdgeTrisPrecise( meshA, meshB, converters.toInt ); |
| 47 | auto contours = orderIntersectionContours( meshA.topology, meshB.topology, intersections ); |
| 48 | OneMeshContours meshAContours, meshBContours; |
| 49 | getOneMeshIntersectionContours( meshA, meshB, contours, &meshAContours, &meshBContours, converters ); |
| 50 | |
| 51 | SortIntersectionsData dataForA{meshB,contours,converters.toInt,nullptr,meshA.topology.vertSize(),false}; |
| 52 | |
| 53 | Vector3f aNorm; |
| 54 | for ( auto f : meshA.topology.getValidFaces() ) |
| 55 | aNorm += meshA.dirDblArea( f ); |
| 56 | aNorm = aNorm.normalized(); |
| 57 | CutMeshParameters params; |
| 58 | params.sortData = &dataForA; |
| 59 | cutMesh( meshA, meshAContours, params ); |
| 60 | |
| 61 | for ( auto f : meshA.topology.getValidFaces() ) |
| 62 | EXPECT_TRUE( dot( meshA.dirDblArea( f ), aNorm ) > 0.0f ); |
| 63 | } |
| 64 | |
| 65 | TEST( MRMesh, MeshCollidePrecise ) |
| 66 | { |
nothing calls this directly
no test coverage detected