Skip to content

Commit

Permalink
switch all to is_allclose
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Apr 23, 2024
1 parent 7f3dc49 commit 7803d92
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions tests/compas/datastructures/test_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,22 +1082,28 @@ def test_vertex_neighborhood_centroid():

def test_vertex_normal():
mesh = Mesh.from_obj(compas.get("quadmesh.obj"))
assert mesh.vertex_normal(0) == [
-0.7875436283909406,
0.07148692938164082,
0.6120985642103861,
]
assert mesh.vertex_normal(5) == [
-0.482011312317331,
-0.32250183520381565,
0.814651864963369,
]
assert TOL.is_allclose(
mesh.vertex_normal(0),
[
-0.7875436283909406,
0.07148692938164082,
0.6120985642103861,
],
)
assert TOL.is_allclose(
mesh.vertex_normal(5),
[
-0.482011312317331,
-0.32250183520381565,
0.814651864963369,
],
)


def test_vertex_curvature():
mesh = Mesh.from_obj(compas.get("quadmesh.obj"))
assert mesh.vertex_curvature(0) == 0.0029617825994936453
assert mesh.vertex_curvature(5) == 0.036193074384009094
assert TOL.is_close(mesh.vertex_curvature(0), 0.0029617825994936453)
assert TOL.is_close(mesh.vertex_curvature(5), 0.036193074384009094)


def test_face_coordinates():
Expand Down Expand Up @@ -1163,15 +1169,15 @@ def test_face_flatness():

def test_face_aspect_ratio():
mesh = Mesh.from_obj(compas.get("quadmesh.obj"))
assert mesh.face_aspect_ratio(0) == 1.2813792520925738
assert TOL.is_close(mesh.face_aspect_ratio(0), 1.2813792520925738)

mesh = Mesh.from_obj(compas.get("faces.obj"))
assert mesh.face_aspect_ratio(0) == 1


def test_face_skewness():
mesh = Mesh.from_obj(compas.get("quadmesh.obj"))
assert mesh.face_skewness(0) == 0.2432393485343291
assert TOL.is_close(mesh.face_skewness(0), 0.2432393485343291)

mesh = Mesh.from_obj(compas.get("faces.obj"))
assert mesh.face_skewness(0) == 0
Expand Down

0 comments on commit 7803d92

Please sign in to comment.