Add membrane plugin (2D Flex elastic stiffness).

PiperOrigin-RevId: 574109411
Change-Id: I4a701d8189cecf540cd200bd30cb4582f3c7dd43
This commit is contained in:
Alessio Quaglino
2023-10-17 04:54:37 -07:00
committed by Copybara-Service
parent 110ade1435
commit d67b8c6251
13 changed files with 586 additions and 115 deletions
+12 -7
View File
@@ -512,6 +512,7 @@ bool mjCFlexcomp::MakeGrid(char* error, int error_sz) {
// 2D
else if (dim==2) {
int quad2tri[2][3] = {{0, 1, 2}, {0, 2, 3}};
for (int ix=0; ix<count[0]; ix++) {
for (int iy=0; iy<count[1]; iy++) {
// add point
@@ -527,13 +528,17 @@ bool mjCFlexcomp::MakeGrid(char* error, int error_sz) {
// add elements
if (ix<count[0]-1 && iy<count[1]-1) {
element.push_back(GridID(ix, iy));
element.push_back(GridID(ix+1, iy));
element.push_back(GridID(ix+1, iy+1));
element.push_back(GridID(ix, iy));
element.push_back(GridID(ix+1, iy+1));
element.push_back(GridID(ix, iy+1));
int vert[4] = {
count[2]*count[1]*(ix+0) + count[2]*(iy+0),
count[2]*count[1]*(ix+1) + count[2]*(iy+0),
count[2]*count[1]*(ix+1) + count[2]*(iy+1),
count[2]*count[1]*(ix+0) + count[2]*(iy+1),
};
for (int s = 0; s < 2; s++) {
for (int v = 0; v < 3; v++) {
element.push_back(vert[quad2tri[s][v]]);
}
}
}
}
}