Commit 0d619f33 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke
Browse files

C++11: Create version of homogenized() for C++11 branch (without macros).

parent dfcc98c8
...@@ -107,6 +107,17 @@ public: ...@@ -107,6 +107,17 @@ public:
typename = typename std::enable_if<are_convertible_to<float, T...>::value>::type> typename = typename std::enable_if<are_convertible_to<float, T...>::value>::type>
constexpr VectorT(T... vs) : Base { static_cast<Scalar>(vs)...} constexpr VectorT(T... vs) : Base { static_cast<Scalar>(vs)...}
{ } { }
template<int D = DIM, typename = typename std::enable_if<D == DIM>::type>
typename std::enable_if<D==4, VectorT>::type
homogenized() const {
return VectorT(
Base::values_[0]/Base::values_[3],
Base::values_[1]/Base::values_[3],
Base::values_[2]/Base::values_[3],
1);
}
#else #else
/// special constructor for 1D vectors /// special constructor for 1D vectors
explicit inline VectorT(const Scalar& v) { explicit inline VectorT(const Scalar& v) {
...@@ -136,7 +147,7 @@ public: ...@@ -136,7 +147,7 @@ public:
Base::values_[0]=v0; Base::values_[1]=v1; Base::values_[2]=v2; Base::values_[3]=v3; Base::values_[0]=v0; Base::values_[1]=v1; Base::values_[2]=v2; Base::values_[3]=v3;
} }
VectorT homogenized() { return VectorT(Base::values_[0]/Base::values_[3], Base::values_[1]/Base::values_[3], Base::values_[2]/Base::values_[3], 1); } VectorT homogenized() const { return VectorT(Base::values_[0]/Base::values_[3], Base::values_[1]/Base::values_[3], Base::values_[2]/Base::values_[3], 1); }
#endif #endif
#if DIM == 5 #if DIM == 5
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment