Skip to content

Commit

Permalink
Change all type::VectorN into VecN (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugtalbot authored Feb 26, 2024
1 parent 1f44268 commit ace107e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Registration_test/InertiaAlign_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<GenerateRigidMass>();
Expand Down
10 changes: 5 additions & 5 deletions src/Registration/ClosestPointRegistrationForceField.inl
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,12 @@ void ClosestPointRegistrationForceField<DataTypes>::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; i<nb; i++)
if(!sourceIgnored[i])
{
type::Vector3 point1 = DataTypes::getCPos(x[i]);
type::Vector3 point2 = DataTypes::getCPos(this->closestPos[i]);
type::Vec3 point1 = DataTypes::getCPos(x[i]);
type::Vec3 point2 = DataTypes::getCPos(this->closestPos[i]);
points.push_back(point1);
points.push_back(point2);
}
Expand All @@ -409,8 +409,8 @@ void ClosestPointRegistrationForceField<DataTypes>::draw(const core::visual::Vis
for (unsigned int i=0; i<nb; i++)
if(!sourceIgnored[i])
{
type::Vector3 point1 = DataTypes::getCPos(x[i]);
type::Vector3 point2 = DataTypes::getCPos(this->closestPos[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<dists.size(); i++) if(max<dists[i]) max=dists[i];
Expand Down
4 changes: 2 additions & 2 deletions src/Registration/InertiaAlign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ void InertiaAlign::init()
positionDistSource = (*m_positions.beginEdit());
for (size_t j = 0; j < waPositions.size(); j++)
{
type::Vector4 pointS,pointT;
type::Vec4 pointS,pointT;
pointS(0) = (*m_positions.beginEdit())[j][0];
pointS(1) = (*m_positions.beginEdit())[j][1];
pointS(2) = (*m_positions.beginEdit())[j][2];
Expand Down Expand Up @@ -577,7 +577,7 @@ void InertiaAlign::init()
msg_info() << "The MTransformSourceMatrix is not a Transformation matrix";
for (size_t i = 0; i < waPositions.size(); i++)
{
type::Vector4 pointS,pointT;
type::Vec4 pointS,pointT;
pointS(0) = (*m_positions.beginEdit())[i][0];
pointS(1) = (*m_positions.beginEdit())[i][1];
pointS(2) = (*m_positions.beginEdit())[i][2];
Expand Down
6 changes: 3 additions & 3 deletions src/Registration/InertiaAlign.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class InertiaAlign: public sofa::core::objectmodel::BaseObject
* Data Fields
*/
/// input
Data <sofa::type::Vector3> targetC;
Data <sofa::type::Vector3> sourceC; ///< input: the gravity center of the source mesh
Data <sofa::type::Vec3> targetC;
Data <sofa::type::Vec3> 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
Expand All @@ -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<sofa::type::Vec<3,SReal> >, type::vector<sofa::type::Vec<3,SReal> >);
Expand Down
4 changes: 2 additions & 2 deletions src/Registration/RegistrationContactForceField.inl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void RegistrationContactForceField<DataTypes>::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<cc.size(); i++)
{
Expand Down Expand Up @@ -199,7 +199,7 @@ void RegistrationContactForceField<DataTypes>::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; i<cc.size(); i++)
Expand Down
4 changes: 2 additions & 2 deletions src/Registration/RegistrationExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ void RegistrationExporter::init()
if (this->f_printLog.getValue()) std::cout<<"RegistrationExporter: "<<this->inFileNames.back()<<" -> "<<this->outFileNames.back()<<std::endl;

// get inverse transforms applied in loader
type::Vector3 scale=loaders[l]->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<SReal> 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 = "<<this->inverseTransforms.back()<<std::endl;
Expand Down

0 comments on commit ace107e

Please sign in to comment.