diff --git a/include/fcl/math/matrix_3f.h b/include/fcl/math/matrix_3f.h index 5c95925206a6940292dc44aaf8e02880a4960963..b79c7f418e5ad750882376939b0c36063bd4688e 100644 --- a/include/fcl/math/matrix_3f.h +++ b/include/fcl/math/matrix_3f.h @@ -171,6 +171,14 @@ public: data.setIdentity(); } + inline bool isIdentity () const + { + return + data (0,0) == 1 && data (0,1) == 0 && data (0,2) == 0 && + data (0,0) == 0 && data (0,1) == 1 && data (0,2) == 0 && + data (0,0) == 0 && data (0,1) == 0 && data (0,2) == 1; + } + inline void setZero() { data.setZero(); diff --git a/include/fcl/math/vec_3f.h b/include/fcl/math/vec_3f.h index 840ba8de3a915781b78df126104c81ca486e7eb3..e1bb0409c38edf1363a794a530597485e912c7d7 100644 --- a/include/fcl/math/vec_3f.h +++ b/include/fcl/math/vec_3f.h @@ -125,9 +125,12 @@ public: } inline U length() const { return sqrt(details::dot_prod3(data, data)); } + inline U norm() const { return sqrt(details::dot_prod3(data, data)); } inline U sqrLength() const { return details::dot_prod3(data, data); } + inline U squaredNorm() const { return details::dot_prod3(data, data); } inline void setValue(U x, U y, U z) { data.setValue(x, y, z); } inline void setValue(U x) { data.setValue(x); } + inline void setZero () {data.setValue (0); } inline bool equal(const Vec3fX& other, U epsilon = std::numeric_limits<U>::epsilon() * 100) const { return details::equal(data, other.data, epsilon); } inline Vec3fX<T>& negate() { data.negate(); return *this; } @@ -241,6 +244,13 @@ static inline std::ostream& operator << (std::ostream& o, const Vec3f& v) return o; } + template <typename T> + inline Vec3fX <T> operator * (const typename Vec3fX <T>::U& t, + const Vec3fX <T>& v) + { + return Vec3fX <T> (v.data * t); + } + }