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

Method test_balls

python/pymesh/tests/test_curvature.py:6–33  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4
5class CurvatureTest(TestCase):
6 def test_balls(self):
7 ball_r1 = pymesh.generate_icosphere(1.0, [0.0, 0.0, 0.0], 4)
8 ball_r2 = pymesh.generate_icosphere(2.0, [1.0, 0.0, 0.0], 4)
9 ball_r3 = pymesh.generate_icosphere(3.0, [0.0, 1.0, 0.0], 4)
10
11 ball_r1.add_attribute("vertex_gaussian_curvature")
12 ball_r2.add_attribute("vertex_gaussian_curvature")
13 ball_r3.add_attribute("vertex_gaussian_curvature")
14
15 ball_r1.add_attribute("vertex_mean_curvature")
16 ball_r2.add_attribute("vertex_mean_curvature")
17 ball_r3.add_attribute("vertex_mean_curvature")
18
19 gaussian_r1 = ball_r1.get_attribute("vertex_gaussian_curvature")
20 gaussian_r2 = ball_r2.get_attribute("vertex_gaussian_curvature")
21 gaussian_r3 = ball_r3.get_attribute("vertex_gaussian_curvature")
22
23 mean_r1 = ball_r1.get_attribute("vertex_mean_curvature")
24 mean_r2 = ball_r2.get_attribute("vertex_mean_curvature")
25 mean_r3 = ball_r3.get_attribute("vertex_mean_curvature")
26
27 self.assertAlmostEqual(1.0, np.amin(gaussian_r1), 2)
28 self.assertAlmostEqual(1.0/4.0, np.amin(gaussian_r2), 2)
29 self.assertAlmostEqual(1.0/9.0, np.amin(gaussian_r3), 2)
30
31 self.assertAlmostEqual(1.0, np.amin(mean_r1), 2)
32 self.assertAlmostEqual(1.0/2.0, np.amin(mean_r2), 2)
33 self.assertAlmostEqual(1.0/3.0, np.amin(mean_r3), 2)

Callers

nothing calls this directly

Calls 2

add_attributeMethod · 0.45
get_attributeMethod · 0.45

Tested by

no test coverage detected