Skip to content

Commit

Permalink
Merge pull request #37 from gergondet/topic/NoUsingNamespace
Browse files Browse the repository at this point in the history
  • Loading branch information
gergondet authored Dec 14, 2020
2 parents b5a92d9 + 97cea6b commit f2829e6
Show file tree
Hide file tree
Showing 24 changed files with 264 additions and 248 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 2-Clause License

Copyright (c) 2012-2019, CNRS-UM LIRMM, CNRS-AIST JRL
Copyright (c) 2012-2020, CNRS-UM LIRMM, CNRS-AIST JRL
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
# Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
#

from conans import python_requires
Expand Down
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#
# Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
# Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
#

set(HEADERS_INCLUDE_DIR
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>$<INSTALL_INTERFACE:include>)

set(HEADERS
${HEADERS_INCLUDE_DIR}/SpaceVecAlg/fwd.h
${HEADERS_INCLUDE_DIR}/SpaceVecAlg/MotionVec.h
${HEADERS_INCLUDE_DIR}/SpaceVecAlg/ForceVec.h
${HEADERS_INCLUDE_DIR}/SpaceVecAlg/ImpedanceVec.h
Expand All @@ -26,6 +27,9 @@ if(COMMAND target_sources)
target_sources(SpaceVecAlg INTERFACE ${HEADERS})
endif()
target_compile_features(SpaceVecAlg INTERFACE cxx_auto_type cxx_constexpr)
if(MSVC)
target_compile_options(SpaceVecAlg PRIVATE /source-charset:utf-8)
endif()
if(TARGET Eigen3::Eigen)
target_link_libraries(SpaceVecAlg INTERFACE Eigen3::Eigen)
else()
Expand Down
49 changes: 25 additions & 24 deletions src/SpaceVecAlg/ABInertia.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/*
* Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
* Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
*/

#pragma once

#include "EigenTypedef.h"
#include "fwd.h"

namespace sva
{

using namespace Eigen;

/**
* Spatial Articulated Body Inertia compact representation.
* See Roy Featherstone «Rigid Body Dynamics Algorithms» page 247.
Expand All @@ -17,9 +18,9 @@ template<typename T>
class ABInertia
{
public:
typedef Vector3<T> vector3_t;
typedef Matrix3<T> matrix3_t;
typedef Matrix6<T> matrix6_t;
typedef Eigen::Vector3<T> vector3_t;
typedef Eigen::Matrix3<T> matrix3_t;
typedef Eigen::Matrix6<T> matrix6_t;

public:
ABInertia() : M_(), H_(), I_() {}
Expand All @@ -32,18 +33,18 @@ class ABInertia
ABInertia(const matrix3_t & M, const matrix3_t & H, const matrix3_t & I)
: M_(matrix3_t::Zero()), H_(H), I_(matrix3_t::Zero())
{
M_.template triangularView<Lower>() = M;
I_.template triangularView<Lower>() = I;
M_.template triangularView<Eigen::Lower>() = M;
I_.template triangularView<Eigen::Lower>() = I;
}

/**
* @param M Lower triangular view of Mass matrix.
* @param H Generalized inertia matrix.
* @param I Lower triangular view Inertia matrix.
*/
ABInertia(const TriangularView<matrix3_t, Lower> & ltM,
ABInertia(const Eigen::TriangularView<matrix3_t, Eigen::Lower> & ltM,
const matrix3_t & H,
const TriangularView<matrix3_t, Lower> & ltI)
const Eigen::TriangularView<matrix3_t, Eigen::Lower> & ltI)
: M_(ltM), H_(H), I_(ltI)
{
}
Expand All @@ -59,8 +60,8 @@ class ABInertia
matrix3_t massMatrix() const
{
matrix3_t M;
M.template triangularView<Upper>() = M_.transpose();
M.template triangularView<StrictlyLower>() = M_;
M.template triangularView<Eigen::Upper>() = M_.transpose();
M.template triangularView<Eigen::StrictlyLower>() = M_;
return M;
}

Expand All @@ -80,8 +81,8 @@ class ABInertia
matrix3_t inertia() const
{
matrix3_t I;
I.template triangularView<Upper>() = I_.transpose();
I.template triangularView<StrictlyLower>() = I_;
I.template triangularView<Eigen::Upper>() = I_.transpose();
I.template triangularView<Eigen::StrictlyLower>() = I_;
return I;
}

Expand All @@ -103,16 +104,16 @@ class ABInertia
ABInertia<T> operator+(const ABInertia<T> & rbI) const
{
matrix3_t M, I;
M.template triangularView<Lower>() = M_ + rbI.M_;
I.template triangularView<Lower>() = I_ + rbI.I_;
M.template triangularView<Eigen::Lower>() = M_ + rbI.M_;
I.template triangularView<Eigen::Lower>() = I_ + rbI.I_;
return ABInertia<T>(M, H_ + rbI.H_, I);
}

ABInertia<T> operator-(const ABInertia<T> & rbI) const
{
matrix3_t M, I;
M.template triangularView<Lower>() = M_ - rbI.M_;
I.template triangularView<Lower>() = I_ - rbI.I_;
M.template triangularView<Eigen::Lower>() = M_ - rbI.M_;
I.template triangularView<Eigen::Lower>() = I_ - rbI.I_;
return ABInertia<T>(M, H_ - rbI.H_, I);
}

Expand All @@ -123,26 +124,26 @@ class ABInertia

ABInertia<T> & operator+=(const ABInertia<T> & rbI)
{
M_.template triangularView<Lower>() += rbI.M_;
M_.template triangularView<Eigen::Lower>() += rbI.M_;
H_ += rbI.H_;
I_.template triangularView<Lower>() += rbI.I_;
I_.template triangularView<Eigen::Lower>() += rbI.I_;
return *this;
}

ABInertia<T> & operator-=(const ABInertia<T> & rbI)
{
M_.template triangularView<Lower>() -= rbI.M_;
M_.template triangularView<Eigen::Lower>() -= rbI.M_;
H_ -= rbI.H_;
I_.template triangularView<Lower>() -= rbI.I_;
I_.template triangularView<Eigen::Lower>() -= rbI.I_;
return *this;
}

template<typename T2>
ABInertia<T> operator*(T2 scalar) const
{
matrix3_t M, I;
M.template triangularView<Lower>() = scalar * M_;
I.template triangularView<Lower>() = scalar * I_;
M.template triangularView<Eigen::Lower>() = scalar * M_;
I.template triangularView<Eigen::Lower>() = scalar * I_;
return ABInertia<T>(M, scalar * H_, I);
}

Expand Down
10 changes: 5 additions & 5 deletions src/SpaceVecAlg/AdmittanceVec.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
* Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
*/

#pragma once

#include "EigenTypedef.h"
#include "fwd.h"
#include <type_traits>

namespace sva
{

using namespace Eigen;

/**
* Admittance Vector.
* Mechanical admittance is a measure of how much a structure moves
Expand All @@ -26,8 +26,8 @@ template<typename T>
class AdmittanceVec
{
public:
typedef Vector3<T> vector3_t;
typedef Vector6<T> vector6_t;
typedef Eigen::Vector3<T> vector3_t;
typedef Eigen::Vector6<T> vector6_t;

public:
/// Zero admittance vector
Expand Down
2 changes: 1 addition & 1 deletion src/SpaceVecAlg/Conversions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
* Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
*/

#pragma once
Expand Down
4 changes: 3 additions & 1 deletion src/SpaceVecAlg/EigenTypedef.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/*
* Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
* Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
*/

#pragma once

#include <Eigen/Core>

namespace Eigen
{

Expand Down
13 changes: 12 additions & 1 deletion src/SpaceVecAlg/EigenUtility.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/*
* Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
* Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
*/

#pragma once

#include "EigenTypedef.h"

namespace Eigen
{

Expand Down Expand Up @@ -40,3 +42,12 @@ inline Matrix6<T> vector6ToCrossDualMatrix(const Vector6<T> & vec)
}

} // namespace Eigen

namespace sva
{

using Eigen::vector3ToCrossMatrix;
using Eigen::vector6ToCrossDualMatrix;
using Eigen::vector6ToCrossMatrix;

} // namespace sva
10 changes: 5 additions & 5 deletions src/SpaceVecAlg/ForceVec.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
* Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
*/

#pragma once

#include "EigenTypedef.h"
#include "fwd.h"
#include <type_traits>

namespace sva
{

using namespace Eigen;

/**
* Spatial Force Vector compact representations.
* See Roy Featherstone «Rigid Body Dynamics Algorithms» page 247.
Expand All @@ -19,8 +19,8 @@ template<typename T>
class ForceVec
{
public:
typedef Vector3<T> vector3_t;
typedef Vector6<T> vector6_t;
typedef Eigen::Vector3<T> vector3_t;
typedef Eigen::Vector6<T> vector6_t;

friend class PTransform<T>;

Expand Down
10 changes: 5 additions & 5 deletions src/SpaceVecAlg/ImpedanceVec.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
* Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
*/

#pragma once

#include "EigenTypedef.h"
#include "fwd.h"
#include <type_traits>

namespace sva
{

using namespace Eigen;

/**
* Impedance Vector.
* Mechanical impedance is a measure of how much a structure resists
Expand All @@ -25,8 +25,8 @@ template<typename T>
class ImpedanceVec
{
public:
typedef Vector3<T> vector3_t;
typedef Vector6<T> vector6_t;
typedef Eigen::Vector3<T> vector3_t;
typedef Eigen::Vector6<T> vector6_t;

public:
/// Zero impedance vector
Expand Down
3 changes: 2 additions & 1 deletion src/SpaceVecAlg/MathFunc.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/*
* Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
* Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
*/

#pragma once

#include <cmath>
#include <limits>

namespace sva
Expand Down
10 changes: 5 additions & 5 deletions src/SpaceVecAlg/MotionVec.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
* Copyright 2012-2020 CNRS-UM LIRMM, CNRS-AIST JRL
*/

#pragma once

#include "EigenTypedef.h"
#include "fwd.h"
#include <type_traits>

namespace sva
{

using namespace Eigen;

/**
* Spatial Motion Vector compact representations.
* See Roy Featherstone «Rigid Body Dynamics Algorithms» page 247.
Expand All @@ -19,8 +19,8 @@ template<typename T>
class MotionVec
{
public:
typedef Vector3<T> vector3_t;
typedef Vector6<T> vector6_t;
typedef Eigen::Vector3<T> vector3_t;
typedef Eigen::Vector6<T> vector6_t;

friend class PTransform<T>;

Expand Down
Loading

0 comments on commit f2829e6

Please sign in to comment.