Add built-in hemisphere mesh.

PiperOrigin-RevId: 791148546
Change-Id: Ic9ff0c9b0f5fa4fd22d5f7f848f150cf74d378ba
This commit is contained in:
Yuval Tassa
2025-08-05 04:15:27 -07:00
committed by Copybara-Service
parent a5a6379f83
commit 5220767457
8 changed files with 179 additions and 2 deletions
+18
View File
@@ -506,6 +506,24 @@ int mjs_makeMesh(mjsMesh* mesh, mjtMeshBuiltin builtin, double* params, int npar
mjCMesh* meshC = static_cast<mjCMesh*>(mesh->element);
mjCModel* m = meshC->model;
switch (builtin) {
case mjMESH_BUILTIN_HEMISPHERE: {
if (nparams != 1) {
m->SetError(mjCError(0, "Hemisphere mesh type requires 1 parameter"));
return -1;
}
int subdiv = static_cast<int>(params[0]);
if (subdiv < 0) {
m->SetError(mjCError(0, "Hemisphere subdivision cannot be negative"));
return -1;
}
if (subdiv > 10) {
m->SetError(mjCError(0, "Hemisphere subdivision cannot be greater than 10"));
return -1;
}
meshC->MakeHemisphere(subdiv, /*make_faces*/ true, /*make_cap*/ true);
return 0;
}
case mjMESH_BUILTIN_WEDGE: {
if (nparams != 5) {
m->SetError(mjCError(0, "Wedge builtin mesh types require 5 parameters"));