From 977fb913cfaf538079934b7ebb999dc9c8acd1e2 Mon Sep 17 00:00:00 2001 From: Alessio Quaglino Date: Wed, 4 Dec 2024 10:36:47 -0800 Subject: [PATCH] Remove hanging vertex from flexcomp circle type. PiperOrigin-RevId: 702777882 Change-Id: I3ce09c0ed81a9b153c606debc8c22fbb47c93e8b --- src/user/user_flexcomp.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/user/user_flexcomp.cc b/src/user/user_flexcomp.cc index 58a50bcb..8ff486ef 100644 --- a/src/user/user_flexcomp.cc +++ b/src/user/user_flexcomp.cc @@ -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)));