From 8419f51e974f563dbec332577e5afdc1752841b1 Mon Sep 17 00:00:00 2001 From: Hugo Talbot Date: Mon, 26 Feb 2024 16:02:40 +0100 Subject: [PATCH 1/2] Change all type::VectorN into VecN --- Registration_test/InertiaAlign_test.cpp | 2 +- .../ClosestPointRegistrationForceField.inl | 10 +++++----- src/Registration/InertiaAlign.cpp | 4 ++-- src/Registration/InertiaAlign.h | 6 +++--- src/Registration/RegistrationContactForceField.inl | 4 ++-- src/Registration/RegistrationExporter.cpp | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Registration_test/InertiaAlign_test.cpp b/Registration_test/InertiaAlign_test.cpp index ea3053e..68d3dfc 100644 --- a/Registration_test/InertiaAlign_test.cpp +++ b/Registration_test/InertiaAlign_test.cpp @@ -68,7 +68,7 @@ using namespace modeling; //GenerateRigid (massSource, centerSource, &meshSource); type::Vec3d centerTarget ; - sofa::type::Vector3 translation; + sofa::type::Vec3 translation; defaulttype::Rigid3Mass massTarget; GenerateRigidMass::SPtr rigidSource = New(); diff --git a/src/Registration/ClosestPointRegistrationForceField.inl b/src/Registration/ClosestPointRegistrationForceField.inl index 1e1d920..a4c9304 100644 --- a/src/Registration/ClosestPointRegistrationForceField.inl +++ b/src/Registration/ClosestPointRegistrationForceField.inl @@ -385,12 +385,12 @@ void ClosestPointRegistrationForceField::draw(const core::visual::Vis unsigned int nb = this->closestPos.size(); if (vparams->displayFlags().getShowForceFields()) { - std::vector< type::Vector3 > points; + std::vector< type::Vec3 > points; for (unsigned int i=0; iclosestPos[i]); + type::Vec3 point1 = DataTypes::getCPos(x[i]); + type::Vec3 point2 = DataTypes::getCPos(this->closestPos[i]); points.push_back(point1); points.push_back(point2); } @@ -409,8 +409,8 @@ void ClosestPointRegistrationForceField::draw(const core::visual::Vis for (unsigned int i=0; iclosestPos[i]); + type::Vec3 point1 = DataTypes::getCPos(x[i]); + type::Vec3 point2 = DataTypes::getCPos(this->closestPos[i]); dists[i]=(point2-point1).norm(); } Real max=0; for (unsigned int i=0; i targetC; - Data sourceC; ///< input: the gravity center of the source mesh + Data targetC; + Data sourceC; ///< input: the gravity center of the source mesh Data < Mat3x3 > targetInertiaMatrix; ///< input: the inertia matrix of the target mesh Data < Mat3x3 > sourceInertiaMatrix; ///< input: the inertia matrix of the source mesh @@ -68,7 +68,7 @@ class InertiaAlign: public sofa::core::objectmodel::BaseObject protected: - typedef type::Vector3 Vector3; + typedef type::Vec3 Vector3; typedef type::Matrix4 Matrix4; SReal computeDistances(type::vector >, type::vector >); diff --git a/src/Registration/RegistrationContactForceField.inl b/src/Registration/RegistrationContactForceField.inl index ad29cf5..64f1f47 100644 --- a/src/Registration/RegistrationContactForceField.inl +++ b/src/Registration/RegistrationContactForceField.inl @@ -164,7 +164,7 @@ void RegistrationContactForceField::draw(const core::visual::VisualPa glDisable(GL_LIGHTING); - std::vector< type::Vector3 > points[4]; + std::vector< type::Vec3 > points[4]; for (unsigned int i=0; i::draw(const core::visual::VisualPa vparams->drawTool()->drawLines(points[2], 1, type::RGBAColor::red()); vparams->drawTool()->drawLines(points[3], 1, type::RGBAColor::green()); - std::vector< type::Vector3 > pointsN; + std::vector< type::Vec3 > pointsN; if (vparams->displayFlags().getShowNormals()) { for (unsigned int i=0; if_printLog.getValue()) std::cout<<"RegistrationExporter: "<inFileNames.back()<<" -> "<outFileNames.back()<getScale(); + type::Vec3 scale=loaders[l]->getScale(); Mat4x4 m_scale; m_scale.fill(0); for(unsigned int i=0;i<3;i++) m_scale[i][i]=1./scale[i]; m_scale[3][3]=1.; type::Quat q = type::Quat< SReal >::createQuaterFromEuler(type::Vec< 3, SReal >(loaders[l]->getRotation()) * M_PI / 180.0); Mat4x4 m_rot; q.inverse().toHomogeneousMatrix(m_rot); - type::Vector3 translation=loaders[l]->getTranslation(); + type::Vec3 translation=loaders[l]->getTranslation(); Mat4x4 m_translation; m_translation.fill(0); for(unsigned int i=0;i<3;i++) m_translation[i][3]=-translation[i]; for(unsigned int i=0;i<4;i++) m_translation[i][i]=1; this->inverseTransforms.push_back(m_scale*m_rot*m_translation); if (this->f_printLog.getValue()) std::cout<<"RegistrationExporter: transform = "<inverseTransforms.back()< Date: Mon, 26 Feb 2024 22:32:21 +0100 Subject: [PATCH 2/2] Fix last remaining Vec4 --- src/Registration/InertiaAlign.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Registration/InertiaAlign.cpp b/src/Registration/InertiaAlign.cpp index 58a4d76..6d86383 100644 --- a/src/Registration/InertiaAlign.cpp +++ b/src/Registration/InertiaAlign.cpp @@ -376,7 +376,7 @@ void InertiaAlign::init() //Construction of S MTransformSource(3,3) = 1; - Vector4 TranslationSource; + Vec4 TranslationSource; MTransformSource(0,3) = -(*sourceC.beginEdit())[0]; MTransformSource(1,3) = -(*sourceC.beginEdit())[1];