Remove hanging vertex from flexcomp circle type.

PiperOrigin-RevId: 702777882
Change-Id: I3ce09c0ed81a9b153c606debc8c22fbb47c93e8b
This commit is contained in:
Alessio Quaglino
2024-12-04 10:36:47 -08:00
committed by Copybara-Service
parent a3b9f986c0
commit 977fb913cf
+6 -4
View File
@@ -550,6 +550,10 @@ bool mjCFlexcomp::MakeGrid(char* error, int error_sz) {
if (dim == 1) {
for (int ix=0; ix < count[0]; ix++) {
if (type == mjFCOMPTYPE_CIRCLE) {
if (ix >= count[0]-1) {
continue;
}
// add point
double theta = 2*mjPI/(count[0]-1);
double radius = spacing[0]/std::sin(theta/2)/2;
@@ -558,10 +562,8 @@ bool mjCFlexcomp::MakeGrid(char* error, int error_sz) {
point.push_back(0);
// add element
if (ix < count[0]-1) {
element.push_back(ix);
element.push_back(ix == count[0]-2 ? 0 : ix+1);
}
element.push_back(ix);
element.push_back(ix == count[0]-2 ? 0 : ix+1);
} else {
// add point
point.push_back(spacing[0]*(ix - 0.5*(count[0]-1)));