Exemplo n.º 1
0
def test_booleans():

    # ==============================================================================
    # Make a box and a sphere
    # ==============================================================================

    box = Box.from_width_height_depth(2, 2, 2)
    box = Mesh.from_shape(box)
    box.quads_to_triangles()

    A = box.to_vertices_and_faces()

    sphere = Sphere(Point(1, 1, 1), 1)
    sphere = Mesh.from_shape(sphere, u=30, v=30)
    sphere.quads_to_triangles()

    B = sphere.to_vertices_and_faces()

    # ==============================================================================
    # Remesh the sphere
    # ==============================================================================

    B = remesh(B, 0.3, 10)

    # ==============================================================================
    # Compute the boolean mesh
    # ==============================================================================

    V, F = boolean_union(A, B)

    mesh = Mesh.from_vertices_and_faces(V, F)
Exemplo n.º 2
0
proxy = Proxy()

# ==============================================================================
# Make a box and a sphere
# ==============================================================================

box = Box.from_width_height_depth(2, 2, 2)
box = Mesh.from_shape(box)
box.quads_to_triangles()

A = box.to_vertices_and_faces()

sphere = Sphere(Point(1, 1, 1), 1)
sphere = Mesh.from_shape(sphere, u=30, v=30)
sphere.quads_to_triangles()

B = sphere.to_vertices_and_faces()

# ==============================================================================
# Remesh the sphere
# ==============================================================================

proxy.package = 'compas_cgal.meshing'

B = proxy.remesh(B, 0.3, 10)

# ==============================================================================
# Compute the intersections
# ==============================================================================