Add mjs_makeMesh to create a builtin mesh.
PiperOrigin-RevId: 788538127 Change-Id: I999733399a1a0da07b0f915f34d31364ab8b3b52
This commit is contained in:
committed by
Copybara-Service
parent
46dc67b7eb
commit
89f4789085
@@ -1001,6 +1001,38 @@ PYBIND11_MODULE(_specs, m) {
|
||||
mjs_setDefault(self.element, &default_);
|
||||
},
|
||||
py::return_value_policy::reference_internal);
|
||||
mjsMesh.def(
|
||||
"make_wedge",
|
||||
[](raw::MjsMesh* self, std::array<int, 2>& resolution, double radius,
|
||||
std::array<double, 2>& fov, double gamma) {
|
||||
double params[5] = {static_cast<double>(resolution[0]),
|
||||
static_cast<double>(resolution[1]), fov[0], fov[1],
|
||||
gamma};
|
||||
if (mjs_makeMesh(self, mjMESH_BUILTIN_WEDGE, params, 5)) {
|
||||
throw pybind11::value_error(mjs_getError(mjs_getSpec(self->element)));
|
||||
}
|
||||
},
|
||||
py::arg("resolution") = std::array<int, 2>{0, 0}, py::arg("radius"),
|
||||
py::arg("fov") = std::array<double, 2>{0, 0}, py::arg("gamma") = 0);
|
||||
mjsMesh.def(
|
||||
"make_prism",
|
||||
[](raw::MjsMesh* self, int nedge) {
|
||||
double params[1] = {static_cast<double>(nedge)};
|
||||
if (mjs_makeMesh(self, mjMESH_BUILTIN_PRISM, params, 1)) {
|
||||
throw pybind11::value_error(mjs_getError(mjs_getSpec(self->element)));
|
||||
}
|
||||
},
|
||||
py::arg("nedge"));
|
||||
mjsMesh.def(
|
||||
"make_plate",
|
||||
[](raw::MjsMesh* self, std::array<int, 2>& resolution) {
|
||||
double params[2] = {static_cast<double>(resolution[0]),
|
||||
static_cast<double>(resolution[1])};
|
||||
if (mjs_makeMesh(self, mjMESH_BUILTIN_PLATE, params, 2)) {
|
||||
throw pybind11::value_error(mjs_getError(mjs_getSpec(self->element)));
|
||||
}
|
||||
},
|
||||
py::arg("resolution") = std::array<int, 2>{0, 0});
|
||||
|
||||
// ============================= MJSPAIR =====================================
|
||||
mjSpec.def("delete", [](MjSpec& self, raw::MjsPair& obj) {
|
||||
|
||||
Reference in New Issue
Block a user