MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / test_3D_area_attribute

Method test_3D_area_attribute

python/pymesh/tests/test_mesh.py:67–86  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

65 self.assertAlmostEqual(-0.5, areas[2])
66
67 def test_3D_area_attribute(self):
68 vertices = np.array([
69 [0.0, 0.0, 0.1],
70 [1.0, 0.0, 0.1],
71 [0.0, 1.0, 0.1] ])
72 faces = np.array([
73 [0, 1, 2],
74 [0, 0, 1],
75 [1, 0, 2]
76 ])
77
78 mesh = pymesh.form_mesh(vertices, faces)
79 mesh.add_attribute("face_area")
80
81 self.assertTrue(mesh.has_attribute("face_area"))
82 areas = mesh.get_face_attribute("face_area").ravel()
83 self.assertEqual(3, len(areas))
84 self.assertAlmostEqual(0.5, areas[0])
85 self.assertAlmostEqual(0, areas[1])
86 self.assertAlmostEqual(0.5, areas[2])
87

Callers

nothing calls this directly

Calls 4

get_face_attributeMethod · 0.80
form_meshMethod · 0.45
add_attributeMethod · 0.45
has_attributeMethod · 0.45

Tested by

no test coverage detected