Example #1
0
def test_plane():
    bounds = Box([(0, 3), (0, 3), (0, 3)])
    plane = Plane((1.5, 1.5, 1.5), (1, 1, 1), bounds)
    field = set(bounds.render())
    points = field - set(plane.render())

    layers = draw_layers(points, on='#', off='-')

    assert_equal(
        '\n\n'.join(layers),
        dedent('''
            ##--
            ###-
            ####
            ####

            #---
            ##--
            ###-
            ####

            ----
            #---
            ##--
            ###-

            ----
            ----
            #---
            ##--
        ''').strip(),
    )
Example #2
0
def test_box_from_volumes():
    volumes = [
        Sphere((1, 1, 1), 3),
        Sphere((-1, -1, -1), 3),
    ]
    bounds = Box.from_volumes(volumes)
    assert_equal(
        bounds,
        Box([(-4, 4), (-4, 4), (-4, 4)]),
    )