Improve builtin hemisphere docs
PiperOrigin-RevId: 791271829 Change-Id: I391215b5388f4e9e2a17198dbcdbd0c605fda4b4
This commit is contained in:
committed by
Copybara-Service
parent
fde479736e
commit
784c7a419b
@@ -1347,11 +1347,12 @@ The full list of processing steps applied by the compiler to each mesh is as fol
|
|||||||
:align: right
|
:align: right
|
||||||
:target: https://github.com/google-deepmind/mujoco/blob/main/test/user/testdata/makemesh.xml
|
:target: https://github.com/google-deepmind/mujoco/blob/main/test/user/testdata/makemesh.xml
|
||||||
|
|
||||||
:at-val:`hemisphere` (subdivision)
|
:at-val:`hemisphere` (resolution)
|
||||||
Repeated subdivisions of a square-based pyramid. For :math:`s` subdivisions, this mesh
|
Quad-projected hemisphere. For resolution :math:`r`, this mesh has :math:`4r` edges and
|
||||||
has :math:`V = 2 + 2(s+1)(s+2)` vertices and :math:`F = 4(s+1)(s+2)` faces.
|
vertices on the equator and a total of :math:`V = 2 + 2(r+1)(r+2)` vertices and
|
||||||
|
:math:`F = 4(r+1)(r+2)` faces.
|
||||||
|
|
||||||
**subdivision**: integer in [0-10]: The number of subdivisions to apply to the pyramid.
|
**resolution**: integer in [0-10]: Equator discretization of one hemisphere quadrant.
|
||||||
|
|
||||||
.. image:: images/XMLreference/c.png
|
.. image:: images/XMLreference/c.png
|
||||||
:width: 23%
|
:width: 23%
|
||||||
|
|||||||
@@ -1025,13 +1025,13 @@ PYBIND11_MODULE(_specs, m) {
|
|||||||
py::arg("subdivision"));
|
py::arg("subdivision"));
|
||||||
mjsMesh.def(
|
mjsMesh.def(
|
||||||
"make_hemisphere",
|
"make_hemisphere",
|
||||||
[](raw::MjsMesh* self, int subdivision) {
|
[](raw::MjsMesh* self, int resolution) {
|
||||||
double params[1] = {static_cast<double>(subdivision)};
|
double params[1] = {static_cast<double>(resolution)};
|
||||||
if (mjs_makeMesh(self, mjMESH_BUILTIN_HEMISPHERE, params, 1)) {
|
if (mjs_makeMesh(self, mjMESH_BUILTIN_HEMISPHERE, params, 1)) {
|
||||||
throw pybind11::value_error(mjs_getError(mjs_getSpec(self->element)));
|
throw pybind11::value_error(mjs_getError(mjs_getSpec(self->element)));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
py::arg("subdivision"));
|
py::arg("resolution"));
|
||||||
mjsMesh.def(
|
mjsMesh.def(
|
||||||
"make_cone",
|
"make_cone",
|
||||||
[](raw::MjsMesh* self, int nedge, double radius) {
|
[](raw::MjsMesh* self, int nedge, double radius) {
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ class SpecsTest(absltest.TestCase):
|
|||||||
mesh.make_cone(nedge=6, radius=0)
|
mesh.make_cone(nedge=6, radius=0)
|
||||||
|
|
||||||
mesh = spec.add_mesh(name='hemisphere')
|
mesh = spec.add_mesh(name='hemisphere')
|
||||||
mesh.make_hemisphere(subdivision=4)
|
mesh.make_hemisphere(resolution=4)
|
||||||
|
|
||||||
mesh = spec.add_mesh(name='sphere')
|
mesh = spec.add_mesh(name='sphere')
|
||||||
mesh.make_sphere(subdivision=2)
|
mesh.make_sphere(subdivision=2)
|
||||||
|
|||||||
@@ -513,11 +513,11 @@ int mjs_makeMesh(mjsMesh* mesh, mjtMeshBuiltin builtin, double* params, int npar
|
|||||||
}
|
}
|
||||||
int subdiv = static_cast<int>(params[0]);
|
int subdiv = static_cast<int>(params[0]);
|
||||||
if (subdiv < 0) {
|
if (subdiv < 0) {
|
||||||
m->SetError(mjCError(0, "Hemisphere subdivision cannot be negative"));
|
m->SetError(mjCError(0, "Hemisphere resolution cannot be negative"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (subdiv > 10) {
|
if (subdiv > 10) {
|
||||||
m->SetError(mjCError(0, "Hemisphere subdivision cannot be greater than 10"));
|
m->SetError(mjCError(0, "Hemisphere resolution cannot be greater than 10"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
meshC->MakeHemisphere(subdiv, /*make_faces*/ true, /*make_cap*/ true);
|
meshC->MakeHemisphere(subdiv, /*make_faces*/ true, /*make_cap*/ true);
|
||||||
|
|||||||
@@ -2066,7 +2066,7 @@ void mjCMesh::CopyGraph() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// make a mesh of a hemisphere
|
// make a mesh of a hemisphere (quad projected)
|
||||||
void mjCMesh::MakeHemisphere(int res, bool make_faces, bool make_cap) {
|
void mjCMesh::MakeHemisphere(int res, bool make_faces, bool make_cap) {
|
||||||
constexpr double kNorthPole[3] = {0, 0, 1};
|
constexpr double kNorthPole[3] = {0, 0, 1};
|
||||||
constexpr double kEquator[4][3] = {
|
constexpr double kEquator[4][3] = {
|
||||||
|
|||||||
Reference in New Issue
Block a user