Skip to content

Commit b9f1a2a

Browse files
committed
test for vertex coordinates
1 parent 7022a04 commit b9f1a2a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/compas/datastructures/test_mesh.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ def triangleboundarychain():
8181
# constructors
8282
# --------------------------------------------------------------------------
8383

84+
def test_constructor():
85+
mesh = Mesh()
86+
a = mesh.add_vertex()
87+
b = mesh.add_vertex(x=1.0)
88+
c = mesh.add_vertex(x=1.0, y=1.0)
89+
d = mesh.add_vertex(y=1.0)
90+
mesh.add_face([a, b, c, d])
91+
assert mesh.vertex_coordinates(a) == [0.0, 0.0, 0.0]
92+
assert mesh.vertex_coordinates(b) == [1.0, 0.0, 0.0]
93+
assert mesh.vertex_coordinates(c) == [1.0, 1.0, 0.0]
94+
assert mesh.vertex_coordinates(d) == [0.0, 1.0, 0.0]
95+
assert mesh.vertex_coordinates(a) == mesh.vertex_attributes(a, 'xyz')
96+
assert mesh.vertex_coordinates(b) == mesh.vertex_attributes(b, 'xyz')
97+
assert mesh.vertex_coordinates(c) == mesh.vertex_attributes(c, 'xyz')
98+
assert mesh.vertex_coordinates(d) == mesh.vertex_attributes(d, 'xyz')
99+
100+
84101
def test_from_obj():
85102
mesh = Mesh.from_obj(compas.get('faces.obj'))
86103
assert mesh.number_of_faces() == 25

0 commit comments

Comments
 (0)