Add quadratic interpolation to flex.

PiperOrigin-RevId: 822055781
Change-Id: Ibc252ac560de666b0b28f868e46b88d3ed92f67d
This commit is contained in:
Alessio Quaglino
2025-10-21 04:35:44 -07:00
committed by Copybara-Service
parent 59f14485e0
commit 01d1ac34e0
8 changed files with 77 additions and 19 deletions
+6 -3
View File
@@ -4109,9 +4109,12 @@ void mjCFlex::Compile(const mjVFS* vfs) {
}
// set nnode
nnode = (int)nodebody_.size();
if (nnode && nnode != 8) {
throw mjCError(this, "number of nodes must be 2^dim, it is %d", "", nnode);
nnode = static_cast<int>(nodebody_.size());
if (nnode && !order_) {
order_ = std::pow(nnode, 1.0 / 3) - 1;
if (nnode != std::pow(order_ + 1, 3)) {
throw mjCError(this, "number of nodes must be %d^3 but it is %d", nullptr, order_, nnode);
}
}
// check elem vertex ids