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

Method test_2D_area_attribute

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

Source from the content-addressed store, hash-verified

44 self.assertEqual(3, len(mesh.get_voxel_adjacent_voxels(7)))
45
46 def test_2D_area_attribute(self):
47 vertices = np.array([
48 [0.0, 0.0],
49 [1.0, 0.0],
50 [0.0, 1.0] ])
51 faces = np.array([
52 [0, 1, 2],
53 [0, 0, 1],
54 [1, 0, 2]
55 ])
56
57 mesh = pymesh.form_mesh(vertices, faces)
58 mesh.add_attribute("face_area")
59
60 self.assertTrue(mesh.has_attribute("face_area"))
61 areas = mesh.get_face_attribute("face_area")
62 self.assertEqual(3, len(areas))
63 self.assertAlmostEqual(0.5, areas[0])
64 self.assertAlmostEqual(0, areas[1])
65 self.assertAlmostEqual(-0.5, areas[2])
66
67 def test_3D_area_attribute(self):
68 vertices = np.array([

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