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

Function test_boolean

test_python/test_boolean.py:5–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4
5def test_boolean():
6 torusIntersected = mrmesh.makeTorusWithSelfIntersections(2, 1, 10, 10, None)
7 mrmesh.fixSelfIntersections(torusIntersected, 0.1)
8
9 torus = mrmesh.makeTorus(2, 1, 10, 10, None)
10
11 transVector = mrmesh.Vector3f()
12 transVector.x = 0.5
13 transVector.y = 1
14 transVector.z = 1
15
16 diffXf = mrmesh.AffineXf3f.translation(transVector)
17
18 torus2 = mrmesh.makeTorus(2, 1, 10, 10, None)
19 torus2.transform(diffXf)
20
21 p = torus.points.vec.size()
22
23 torusS = mrmesh.voxelBooleanSubtract(torus, torus2, 0.05)
24 p_sub = torusS.points.vec.size()
25
26 torusU = mrmesh.voxelBooleanUnite(torus, torus2, 0.05)
27 p_union = torusU.points.vec.size()
28
29 torusI = mrmesh.voxelBooleanIntersect(torus, torus2, 0.05)
30 p_intersect = torusI.points.vec.size()
31
32 assert p == 100
33 assert p_sub == 43132
34 assert p_union == 63114 \
35 or p_union == 63112 # on some macOS Arm runners in Debug mode
36 assert p_intersect == 23006

Callers

nothing calls this directly

Calls 3

translationMethod · 0.80
transformMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected