Normalize triangle coordinates such that their sum rather their norm is one.
This ensures that at e.g. the barycenter of the triangle each vertex has weight 1/3, as one would expect with barycentric coordinates, rather than 1/sqrt(3). This makes it consistent to the finite element interpolation used in the passive elastic forces. PiperOrigin-RevId: 823458736 Change-Id: Ia5c02cba186a80612de38402f791695c33e991ab
This commit is contained in:
committed by
Copybara-Service
parent
7bf065c75b
commit
ec8ad21cb5
@@ -172,7 +172,11 @@ static int mj_elemBodyWeight(const mjModel* m, const mjData* d, int f, int e, in
|
||||
}
|
||||
|
||||
// normalize weights
|
||||
mju_normalize(weight, dim+1);
|
||||
mjtNum sum = mju_sum(weight, dim+1);
|
||||
if (sum < mjMINVAL) {
|
||||
mjERROR("element body weight sum < mjMINVAL");
|
||||
}
|
||||
mju_scl(weight, weight, 1.0/sum, dim+1);
|
||||
return dim+1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user