| 5 | |
| 6 | |
| 7 | def test_segmentation(): |
| 8 | mesh = mrmesh.makeTorus() |
| 9 | metric = mrmesh.edgeLengthMetric(mesh) |
| 10 | source = mrmesh.FaceBitSet() |
| 11 | sink = mrmesh.FaceBitSet() |
| 12 | source.resize(mesh.topology.getValidFaces().size(), False) |
| 13 | sink.resize(mesh.topology.getValidFaces().size(), False) |
| 14 | |
| 15 | source.set(mrmesh.FaceId(0), True) |
| 16 | sink.set(mrmesh.FaceId(5), True) |
| 17 | |
| 18 | res = mrmesh.segmentByGraphCut(mesh.topology, source, sink, metric) |
| 19 | |
| 20 | assert res.count() != 0 |
| 21 | assert res.test(mrmesh.FaceId(0)) |
| 22 | assert not res.test(mrmesh.FaceId(5)) |