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

Function TEST

source/MRTest/MRMeshBooleanTests.cpp:15–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13{
14
15TEST( MRMesh, MeshBoolean )
16{
17 Mesh meshA = makeTorus( 1.1f, 0.5f, 8, 8 );
18 Mesh meshB = makeTorus( 1.0f, 0.2f, 8, 8 );
19 meshB.transform( AffineXf3f::linear( Matrix3f::rotation( Vector3f::plusZ(), Vector3f::plusY() ) ) );
20
21 const float shiftStep = 0.2f;
22 const float angleStep = PI_F;/* *1.0f / 3.0f*/;
23 const std::array<Vector3f, 3> baseAxis{Vector3f::plusX(),Vector3f::plusY(),Vector3f::plusZ()};
24 for ( int maskTrans = 0; maskTrans < 8; ++maskTrans )
25 {
26 for ( int maskRot = 0; maskRot < 8; ++maskRot )
27 {
28 for ( float shift = 0.01f; shift < 0.2f; shift += shiftStep )
29 {
30 Vector3f shiftVec;
31 for ( int i = 0; i < 3; ++i )
32 if ( maskTrans & ( 1 << i ) )
33 shiftVec += shift * baseAxis[i];
34 for ( float angle = PI_F * 0.01f; angle < PI_F * 7.0f / 18.0f; angle += angleStep )
35 {
36 Matrix3f rotation;
37 for ( int i = 0; i < 3; ++i )
38 if ( maskRot & ( 1 << i ) )
39 rotation = Matrix3f::rotation( baseAxis[i], angle ) * rotation;
40
41 AffineXf3f xf;
42 xf = AffineXf3f::translation( shiftVec ) * AffineXf3f::linear( rotation );
43
44 EXPECT_TRUE( boolean( meshA, meshB, BooleanOperation::Union, &xf ).valid() );
45 EXPECT_TRUE( boolean( meshB, meshA, BooleanOperation::Intersection, &xf ).valid() );
46 }
47 }
48 }
49 }
50}
51
52
53TEST( MRMesh, BooleanMultipleEdgePropogationSort )

Callers

nothing calls this directly

Calls 15

makeTorusFunction · 0.85
booleanFunction · 0.85
fromTrianglesFunction · 0.85
makeCubeFunction · 0.85
diagonalFunction · 0.85
BooleanOperationEnum · 0.85
addMeshPartMethod · 0.80
mapMethod · 0.80
countMethod · 0.80
newFacesMethod · 0.80
trackRightBoundaryLoopFunction · 0.50

Tested by

no test coverage detected