From 2405dd23a205df3b95d02a59c62fe5bd738d60dd Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Thu, 9 Dec 2021 15:24:11 +0100 Subject: [PATCH] [SofaConstraint] Fix BilateralInteractionConstraint's draw() (#2530) --- .../SofaConstraint/BilateralInteractionConstraint.inl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/SofaConstraint/src/SofaConstraint/BilateralInteractionConstraint.inl b/modules/SofaConstraint/src/SofaConstraint/BilateralInteractionConstraint.inl index 55c15e1b990..bc1ee7181b3 100644 --- a/modules/SofaConstraint/src/SofaConstraint/BilateralInteractionConstraint.inl +++ b/modules/SofaConstraint/src/SofaConstraint/BilateralInteractionConstraint.inl @@ -522,10 +522,15 @@ void BilateralInteractionConstraint::draw(const core::visual::VisualP std::vector< sofa::type::Vector3 > vertices; unsigned minp = std::min(m1.getValue().size(),m2.getValue().size()); + auto positionsM1 = sofa::helper::getReadAccessor(*this->mstate1->read(ConstVecCoordId::position())); + auto positionsM2 = sofa::helper::getReadAccessor(*this->mstate2->read(ConstVecCoordId::position())); + auto indicesM1 = sofa::helper::getReadAccessor(m1); + auto indicesM2 = sofa::helper::getReadAccessor(m2); + for (unsigned i=0; imstate1->read(ConstVecCoordId::position())->getValue()[m1.getValue()[i]])); - vertices.push_back(DataTypes::getCPos(this->mstate2->read(ConstVecCoordId::position())->getValue()[m1.getValue()[i]])); + vertices.push_back(DataTypes::getCPos(positionsM1[indicesM1[i]])); + vertices.push_back(DataTypes::getCPos(positionsM2[indicesM2[i]])); } vparams->drawTool()->drawPoints(vertices, 10, (activated) ? colorActive : colorNotActive);