Add built-in sphere mesh.

PiperOrigin-RevId: 791162850
Change-Id: I573a414727e79f1a495e0f2282b2faff48ab3443
This commit is contained in:
Yuval Tassa
2025-08-05 05:04:11 -07:00
committed by Copybara-Service
parent 5220767457
commit 996f0040fd
8 changed files with 165 additions and 8 deletions
+5 -1
View File
@@ -499,12 +499,16 @@ class SpecsTest(absltest.TestCase):
mesh = spec.add_mesh(name='hemisphere')
mesh.make_hemisphere(subdivision=4)
mesh = spec.add_mesh(name='sphere')
mesh.make_sphere(subdivision=2)
model = spec.compile()
self.assertEqual(model.nmesh, 4)
self.assertEqual(model.nmesh, 5)
self.assertEqual(model.mesh_vertnum[0], 25 * 25)
self.assertEqual(model.mesh_vertnum[1], 10)
self.assertEqual(model.mesh_vertnum[2], 7)
self.assertEqual(model.mesh_vertnum[3], 2 * (4 + 1) * (4 + 2) + 2)
self.assertEqual(model.mesh_vertnum[4], 2 + 10 * 4**2)
def test_compile_errors_with_line_info(self):
spec = mujoco.MjSpec()