Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Nov 19, 2023
1 parent 610ede6 commit d2d39c9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 32 deletions.
4 changes: 2 additions & 2 deletions tests/_test_slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from compas.datastructures import Mesh

from compas_cgal import HERE
from compas_cgal.slicer import slice_mesh
from compas_cgal.slicer import slice_mesh_planes


def test_slicer():
Expand Down Expand Up @@ -43,7 +43,7 @@ def test_slicer():

M = benchy.to_vertices_and_faces()

pointsets = slice_mesh(M, planes)
pointsets = slice_mesh_planes(M, planes)

# ==============================================================================
# Process output
Expand Down
19 changes: 6 additions & 13 deletions tests/test_booleans.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from compas.geometry import Point
from compas.geometry import Box
from compas.geometry import Sphere
from compas.datastructures import Mesh

from compas_cgal.booleans import boolean_union
from compas_cgal.booleans import boolean_union_mesh_mesh
from compas_cgal.meshing import remesh


Expand All @@ -12,17 +11,11 @@ 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()
box = Box(2)
A = box.to_vertices_and_faces(triangulated=True)

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()
sphere = Sphere(1, point=[1, 1, 1])
B = sphere.to_vertices_and_faces(u=32, v=32, triangulated=True)

# ==============================================================================
# Remesh the sphere
Expand All @@ -34,6 +27,6 @@ def test_booleans():
# Compute the boolean mesh
# ==============================================================================

V, F = boolean_union(A, B)
V, F = boolean_union_mesh_mesh(A, B)

Mesh.from_vertices_and_faces(V, F)
23 changes: 6 additions & 17 deletions tests/test_intersections.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,17 @@
from compas.datastructures import Mesh


from compas_cgal._cgal import intersections
from compas_cgal.intersections import intersection_mesh_mesh


def test_intersections():
A = Sphere(Point(0, 0, 0), 1.0)
A = Mesh.from_shape(A, u=50, v=50)
A.quads_to_triangles()

B = Sphere(Point(1.0, 0, 0), 1.0)
B = Mesh.from_shape(B, u=50, v=50)
B.quads_to_triangles()

va, fa = A.to_vertices_and_faces()
VA = np.asarray(va, dtype=np.float64)
FA = np.asarray(fa, dtype=np.int32)

vb, fb = B.to_vertices_and_faces()
VB = np.asarray(vb, dtype=np.float64)
FB = np.asarray(fb, dtype=np.int32)
A = Sphere(1.0).to_vertices_and_faces(u=50, v=50, triangulated=True)
B = Sphere(1.0, point=[1, 0, 0]).to_vertices_and_faces(
u=50, v=50, triangulated=True
)

polylines = []
pointsets = intersections.intersection_mesh_mesh(VA, FA, VB, FB)
pointsets = intersection_mesh_mesh(A, B)
for points in pointsets:
points = [
Point(*point) for point in points
Expand Down

0 comments on commit d2d39c9

Please sign in to comment.