()
| 564 | |
| 565 | # %% bool ops |
| 566 | def test_operators(): |
| 567 | |
| 568 | b1 = box(1, 1, 1).moved(Location(-0.5, -0.5, -0.5)) # small box |
| 569 | b2 = box(2, 2, 2).moved(Location(-1, -1, -1)) # large box |
| 570 | b3 = b1.moved(Location(0, 0, 1e-4)) # almost b1 |
| 571 | f = plane(3, 3) # face |
| 572 | e = segment((-2, 0), (2, 0)) # edge |
| 573 | |
| 574 | assert (b2 - b1).Volume() == approx(8 - 1) |
| 575 | |
| 576 | assert (b2 * b1).Volume() == approx(1) |
| 577 | assert (b1 * f).Area() == approx(1) |
| 578 | assert (b1 * e).Length() == approx(1) |
| 579 | assert (f * e).Length() == approx(3) |
| 580 | |
| 581 | assert (b2 + b1).Volume() == approx(8) |
| 582 | |
| 583 | assert len((b1 / f).Solids()) == 2 |
| 584 | |
| 585 | # test fuzzy ops |
| 586 | assert len((b1 + b3).Faces()) == 14 |
| 587 | assert (b1 - b3).Volume() > 0 |
| 588 | assert (b1 * b3).Volume() < 1 |
| 589 | |
| 590 | assert len(fuse(b1, b3, tol=1e-3).Faces()) == 6 |
| 591 | assert len(cut(b1, b3, tol=1e-3).Faces()) == 0 |
| 592 | assert len(intersect(b1, b3, tol=1e-3).Faces()) == 6 |
| 593 | |
| 594 | |
| 595 | def test_imprint(): |
nothing calls this directly
no test coverage detected