42#ifndef OPENMESH_SRC_OPENMESH_CORE_GEOMETRY_VECTOR11T_HH_
43#define OPENMESH_SRC_OPENMESH_CORE_GEOMETRY_VECTOR11T_HH_
58#include <OpenMesh/Core/System/config.h>
66template<
typename ... Ts>
67struct are_convertible_to;
69template<
typename To,
typename From,
typename ... Froms>
70struct are_convertible_to<To, From, Froms...> {
71 static constexpr bool value = std::is_convertible<From, To>::value
72 && are_convertible_to<To, Froms...>::value;
75template<
typename To,
typename From>
76struct are_convertible_to<To, From> :
public std::is_convertible<From, To> {
82template<
typename Scalar,
int DIM>
85 static_assert(DIM >= 1,
"VectorT requires positive dimensionality.");
88 using container = std::array<Scalar, DIM>;
102 static constexpr int dim() {
107 static constexpr size_t size() {
111 static constexpr const size_t size_ = DIM;
115 template<
typename ... T,
116 typename =
typename std::enable_if<
sizeof...(T) == DIM>::type,
117 typename =
typename std::enable_if<
118 are_convertible_to<Scalar, T...>::value>::type>
119 constexpr VectorT(T... vs) : values_ { {
static_cast<Scalar
>(vs)...} } {
120 static_assert(
sizeof...(T) == DIM,
121 "Invalid number of components specified in constructor.");
122 static_assert(are_convertible_to<Scalar, T...>::value,
123 "Not all components are convertible to Scalar.");
145 template<
typename S = Scalar,
int D = DIM>
147 typename std::enable_if<D == 4,
148 VectorT<decltype(std::declval<S>()/std::declval<S>()), DIM>>::type {
149 static_assert(D == DIM,
"D and DIM need to be identical. (Never "
150 "override the default template arguments.)");
151 static_assert(std::is_same<S, Scalar>::value,
"S and Scalar need "
152 "to be the same type. (Never override the default template "
155 values_[0]/values_[3],
156 values_[1]/values_[3],
157 values_[2]/values_[3],
162 template<
typename Iterator,
164 *std::declval<Iterator&>(), void(),
165 ++std::declval<Iterator&>(), void())>
167 std::copy_n(it, DIM, values_.begin());
171 template<
typename otherScalarType,
172 typename =
typename std::enable_if<
173 std::is_convertible<otherScalarType, Scalar>::value>>
174 explicit VectorT(
const VectorT<otherScalarType, DIM>& _rhs) {
181 template<
typename OtherScalar,
182 typename =
typename std::enable_if<
183 std::is_convertible<OtherScalar, Scalar>::value>>
185 std::transform(_rhs.
data(), _rhs.
data() + DIM,
186 data(), [](OtherScalar rhs) {
187 return static_cast<Scalar
>(std::move(rhs));
193 Scalar*
data() {
return values_.data(); }
196 const Scalar *
data()
const {
return values_.data(); }
216 return std::equal(_rhs.values_.cbegin(), _rhs.values_.cend(), values_.cbegin());
221 return !std::equal(_rhs.values_.cbegin(), _rhs.values_.cend(), values_.cbegin());
227 template<
typename OtherScalar>
229 typename std::enable_if<std::is_convertible<
230 decltype(this->values_[0] * _s), Scalar>::value,
231 VectorT<Scalar, DIM>&>::type {
232 for (
auto& e : *
this) {
239 template<
typename OtherScalar>
241 typename std::enable_if<std::is_convertible<
242 decltype(this->values_[0] / _s), Scalar>::value,
243 VectorT<Scalar, DIM>&>::type {
244 for (
auto& e : *
this) {
251 template<
typename OtherScalar>
252 typename std::enable_if<std::is_convertible<
253 decltype(std::declval<Scalar>() * std::declval<OtherScalar>()),
256 operator*(
const OtherScalar& _s)
const {
261 template<
typename OtherScalar>
262 typename std::enable_if<std::is_convertible<
263 decltype(std::declval<Scalar>() / std::declval<OtherScalar>()),
266 operator/(
const OtherScalar& _s)
const {
273 template<
typename OtherScalar>
275 typename std::enable_if<
276 sizeof(
decltype(this->values_[0] * *_rhs.data())) >= 0,
278 for (
int i = 0; i < DIM; ++i) {
279 data()[i] *= _rhs.data()[i];
285 template<
typename OtherScalar>
287 typename std::enable_if<
288 sizeof(
decltype(this->values_[0] / *_rhs.data())) >= 0,
290 for (
int i = 0; i < DIM; ++i) {
291 data()[i] /= _rhs.data()[i];
297 template<
typename OtherScalar>
299 typename std::enable_if<
300 sizeof(
decltype(this->values_[0] - *_rhs.data())) >= 0,
302 for (
int i = 0; i < DIM; ++i) {
303 data()[i] -= _rhs.data()[i];
309 template<
typename OtherScalar>
311 typename std::enable_if<
312 sizeof(
decltype(this->values_[0] + *_rhs.data())) >= 0,
314 for (
int i = 0; i < DIM; ++i) {
315 data()[i] += _rhs.data()[i];
321 template<
typename OtherScalar>
322 auto operator*(
const VectorT<OtherScalar, DIM>& _rhs)
const ->
323 typename std::enable_if<
324 sizeof(
decltype(this->values_[0] * *_rhs.data())) >= 0,
330 template<
typename OtherScalar>
331 auto operator/(
const VectorT<OtherScalar, DIM>& _rhs)
const ->
332 typename std::enable_if<
333 sizeof(
decltype(this->values_[0] / *_rhs.data())) >= 0,
339 template<
typename OtherScalar>
340 auto operator+(
const VectorT<OtherScalar, DIM>& _rhs)
const ->
341 typename std::enable_if<
342 sizeof(
decltype(this->values_[0] + *_rhs.data())) >= 0,
348 template<
typename OtherScalar>
349 auto operator-(
const VectorT<OtherScalar, DIM>& _rhs)
const ->
350 typename std::enable_if<
351 sizeof(
decltype(this->values_[0] - *_rhs.data())) >= 0,
359 std::transform(values_.begin(), values_.end(), v.values_.begin(),
360 [](
const Scalar &s) { return -s; });
366 template<
typename OtherScalar>
367 auto operator% (
const VectorT<OtherScalar, DIM> &_rhs)
const ->
368 typename std::enable_if<DIM == 3,
369 VectorT<
decltype((*this)[0] * _rhs[0] -
370 (*this)[0] * _rhs[0]),
373 values_[1] * _rhs[2] - values_[2] * _rhs[1],
374 values_[2] * _rhs[0] - values_[0] * _rhs[2],
375 values_[0] * _rhs[1] - values_[1] * _rhs[0]
381 template<
typename OtherScalar>
382 auto operator|(
const VectorT<OtherScalar, DIM>& _rhs)
const ->
383 decltype(*this->
data() * *_rhs.data()) {
385 return std::inner_product(
data() + 1,
data() + DIM, _rhs.data() + 1,
386 *
data() * *_rhs.data());
395 template<
typename S = Scalar>
396 decltype(std::declval<S>() * std::declval<S>())
sqrnorm()
const {
397 static_assert(std::is_same<S, Scalar>::value,
"S and Scalar need "
398 "to be the same type. (Never override the default template "
400 typedef decltype(values_[0] * values_[0]) RESULT;
401 return std::accumulate(values_.cbegin() + 1, values_.cend(),
402 values_[0] * values_[0],
403 [](
const RESULT &l,
const Scalar &r) { return l + r * r; });
407 template<
typename S = Scalar>
409 decltype(std::sqrt(std::declval<VectorT<S, DIM>>().
sqrnorm())) {
410 static_assert(std::is_same<S, Scalar>::value,
"S and Scalar need "
411 "to be the same type. (Never override the default template "
416 template<
typename S = Scalar>
418 decltype(std::declval<VectorT<S, DIM>>().
norm()) {
419 static_assert(std::is_same<S, Scalar>::value,
"S and Scalar need "
420 "to be the same type. (Never override the default template "
427 template<
typename S = Scalar>
429 decltype(*
this /= std::declval<VectorT<S, DIM>>().norm()) {
430 static_assert(std::is_same<S, Scalar>::value,
"S and Scalar need "
431 "to be the same type. (Never override the default template "
433 return *
this /=
norm();
438 template<
typename S = Scalar>
440 decltype(*this / std::declval<VectorT<S, DIM>>().
norm()) {
441 static_assert(std::is_same<S, Scalar>::value,
"S and Scalar need "
442 "to be the same type. (Never override the default template "
444 return *
this /
norm();
449 template<
typename S = Scalar>
450 typename std::enable_if<
453 std::declval<VectorT<S, DIM>>().norm())) >= 0,
456 static_assert(std::is_same<S, Scalar>::value,
"S and Scalar need "
457 "to be the same type. (Never override the default template "
460 if (n !=
static_cast<decltype(
norm())
>(0)) {
475 return std::accumulate(
476 values_.cbegin() + 1, values_.cend(), values_[0]);
493 return *std::max_element(values_.cbegin(), values_.cend());
499 *std::max_element(values_.cbegin(), values_.cend(),
500 [](
const Scalar &a,
const Scalar &b) {
501 return std::abs(a) < std::abs(b);
507 return *std::min_element(values_.cbegin(), values_.cend());
513 *std::min_element(values_.cbegin(), values_.cend(),
514 [](
const Scalar &a,
const Scalar &b) {
515 return std::abs(a) < std::abs(b);
526 return std::accumulate(values_.cbegin() + 1, values_.cend(),
527 std::abs(values_[0]),
528 [](
const Scalar &l,
const Scalar &r) {
529 return l + std::abs(r);
535 std::transform(values_.cbegin(), values_.cend(),
536 _rhs.values_.cbegin(),
538 [](
const Scalar &l,
const Scalar &r) {
539 return std::min(l, r);
547 std::transform(values_.cbegin(), values_.cend(),
548 _rhs.values_.cbegin(),
550 [&result](
const Scalar &l,
const Scalar &r) {
563 std::transform(values_.cbegin(), values_.cend(),
564 _rhs.values_.cbegin(),
566 [](
const Scalar &l,
const Scalar &r) {
567 return std::max(l, r);
575 std::transform(values_.cbegin(), values_.cend(),
576 _rhs.values_.cbegin(),
578 [&result](
const Scalar &l,
const Scalar &r) {
604 template<
typename Functor>
607 std::transform(result.values_.begin(), result.values_.end(),
608 result.values_.begin(), _func);
614 std::fill(values_.begin(), values_.end(), _s);
625 return std::lexicographical_compare(
626 values_.begin(), values_.end(),
627 _rhs.values_.begin(), _rhs.values_.end());
632 noexcept(
noexcept(std::swap(values_, _other.values_))) {
633 std::swap(values_, _other.values_);
641 using iterator =
typename container::iterator;
642 using const_iterator =
typename container::const_iterator;
643 using reverse_iterator =
typename container::reverse_iterator;
644 using const_reverse_iterator =
typename container::const_reverse_iterator;
646 iterator begin() noexcept {
return values_.begin(); }
647 const_iterator begin() const noexcept {
return values_.cbegin(); }
648 const_iterator cbegin() const noexcept {
return values_.cbegin(); }
650 iterator end() noexcept {
return values_.end(); }
651 const_iterator end() const noexcept {
return values_.cend(); }
652 const_iterator cend() const noexcept {
return values_.cend(); }
654 reverse_iterator rbegin() noexcept {
return values_.rbegin(); }
655 const_reverse_iterator rbegin() const noexcept {
return values_.crbegin(); }
656 const_reverse_iterator crbegin() const noexcept {
return values_.crbegin(); }
658 reverse_iterator rend() noexcept {
return values_.rend(); }
659 const_reverse_iterator rend() const noexcept {
return values_.crend(); }
660 const_reverse_iterator crend() const noexcept {
return values_.crend(); }
666template<
typename Scalar,
int DIM,
typename OtherScalar>
668 decltype(rhs.operator*(_s)) {
674template<
typename Scalar,
int DIM>
676 typename std::enable_if<
677 sizeof(
decltype(os << _vec[0])) >= 0, std::ostream&>::type {
680 for (
int i = 1; i < DIM; ++i) {
681 os <<
" " << _vec[i];
687template<
typename Scalar,
int DIM>
689 typename std::enable_if<
690 sizeof(
decltype(is >> _vec[0])) >= 0, std::istream &>::type {
691 for (
int i = 0; i < DIM; ++i)
698template<
typename Scalar,
int DIM>
699Scalar
dot(
const VectorT<Scalar, DIM>& _v1,
const VectorT<Scalar, DIM>& _v2) {
705template<
typename LScalar,
typename RScalar,
int DIM>
707cross(
const VectorT<LScalar, DIM>& _v1,
const VectorT<RScalar, DIM>& _v2) ->
708 decltype(_v1 % _v2) {
714template<
typename Scalar,
int DIM>
715void swap(VectorT<Scalar, DIM>& _v1, VectorT<Scalar, DIM>& _v2)
716noexcept(
noexcept(_v1.swap(_v2))) {
836constexpr OpenMesh::Vec4f operator"" _htmlColor(
unsigned long long raw_color) {
838 ((raw_color >> 24) & 0xFF) / 255.0f,
839 ((raw_color >> 16) & 0xFF) / 255.0f,
840 ((raw_color >> 8) & 0xFF) / 255.0f,
841 ((raw_color >> 0) & 0xFF) / 255.0f);
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition MeshItems.hh:64
VectorT< signed char, 3 > Vec3c
3-byte signed vector
Definition Vector11T.hh:757
VectorT< double, 3 > Vec3d
3-double vector
Definition Vector11T.hh:771
VectorT< signed int, 1 > Vec1i
1-int signed vector
Definition Vector11T.hh:731
VectorT< unsigned char, 5 > Vec5uc
5-byte unsigned vector
Definition Vector11T.hh:795
VectorT< unsigned int, 2 > Vec2ui
2-int unsigned vector
Definition Vector11T.hh:750
VectorT< double, 1 > Vec1d
1-double vector
Definition Vector11T.hh:737
VectorT< double, 4 > Vec4d
4-double vector
Definition Vector11T.hh:790
VectorT< float, 2 > Vec2f
2-float vector
Definition Vector11T.hh:752
VectorT< signed short int, 3 > Vec3s
3-short signed vector
Definition Vector11T.hh:761
VectorT< double, 2 > Vec2d
2-double vector
Definition Vector11T.hh:754
VectorT< signed int, 5 > Vec5i
5-int signed vector
Definition Vector11T.hh:801
VectorT< signed char, 4 > Vec4c
4-byte signed vector
Definition Vector11T.hh:776
VectorT< signed char, 5 > Vec5c
5-byte signed vector
Definition Vector11T.hh:793
VectorT< unsigned int, 5 > Vec5ui
5-int unsigned vector
Definition Vector11T.hh:803
VectorT< signed short int, 5 > Vec5s
5-short signed vector
Definition Vector11T.hh:797
VectorT< unsigned int, 4 > Vec4ui
4-int unsigned vector
Definition Vector11T.hh:786
VectorT< unsigned short int, 3 > Vec3us
3-short unsigned vector
Definition Vector11T.hh:763
VectorT< unsigned char, 3 > Vec3uc
3-byte unsigned vector
Definition Vector11T.hh:759
VectorT< signed short int, 2 > Vec2s
2-short signed vector
Definition Vector11T.hh:744
VectorT< signed int, 2 > Vec2i
2-int signed vector
Definition Vector11T.hh:748
auto operator*(const OtherScalar &_s, const VectorT< Scalar, DIM > &rhs) -> decltype(rhs.operator*(_s))
Component wise multiplication from the left.
Definition Vector11T.hh:667
VectorT< signed char, 2 > Vec2c
2-byte signed vector
Definition Vector11T.hh:740
VectorT< unsigned short int, 2 > Vec2us
2-short unsigned vector
Definition Vector11T.hh:746
VectorT< signed char, 6 > Vec6c
6-byte signed vector
Definition Vector11T.hh:810
VectorT< signed int, 6 > Vec6i
6-int signed vector
Definition Vector11T.hh:818
VectorT< signed int, 4 > Vec4i
4-int signed vector
Definition Vector11T.hh:784
VectorT< signed short int, 4 > Vec4s
4-short signed vector
Definition Vector11T.hh:780
VectorT< unsigned char, 6 > Vec6uc
6-byte unsigned vector
Definition Vector11T.hh:812
VectorT< float, 6 > Vec6f
6-float vector
Definition Vector11T.hh:822
auto operator<<(std::ostream &os, const VectorT< Scalar, DIM > &_vec) -> typename std::enable_if< sizeof(decltype(os<< _vec[0])) >=0
output a vector by printing its space-separated compontens
VectorT< float, 5 > Vec5f
5-float vector
Definition Vector11T.hh:805
VectorT< unsigned char, 2 > Vec2uc
2-byte unsigned vector
Definition Vector11T.hh:742
VectorT< unsigned int, 6 > Vec6ui
6-int unsigned vector
Definition Vector11T.hh:820
VectorT< float, 4 > Vec4f
4-float vector
Definition Vector11T.hh:788
VectorT< unsigned char, 1 > Vec1uc
1-byte unsigned vector
Definition Vector11T.hh:725
VectorT< unsigned char, 4 > Vec4uc
4-byte unsigned vector
Definition Vector11T.hh:778
VectorT< unsigned short int, 1 > Vec1us
1-short unsigned vector
Definition Vector11T.hh:729
VectorT< float, 1 > Vec1f
1-float vector
Definition Vector11T.hh:735
VectorT< double, 6 > Vec6d
6-double vector
Definition Vector11T.hh:824
VectorT< signed short int, 1 > Vec1s
1-short signed vector
Definition Vector11T.hh:727
VectorT< bool, 3 > Vec3b
3-bool vector
Definition Vector11T.hh:773
VectorT< unsigned int, 1 > Vec1ui
1-int unsigned vector
Definition Vector11T.hh:733
VectorT< signed char, 1 > Vec1c
1-byte signed vector
Definition Vector11T.hh:723
VectorT< double, 5 > Vec5d
5-double vector
Definition Vector11T.hh:807
VectorT< unsigned short int, 4 > Vec4us
4-short unsigned vector
Definition Vector11T.hh:782
VectorT< unsigned int, 3 > Vec3ui
3-int unsigned vector
Definition Vector11T.hh:767
VectorT< unsigned short int, 6 > Vec6us
6-short unsigned vector
Definition Vector11T.hh:816
VectorT< unsigned short int, 5 > Vec5us
5-short unsigned vector
Definition Vector11T.hh:799
VectorT< float, 3 > Vec3f
3-float vector
Definition Vector11T.hh:769
VectorT< signed short int, 6 > Vec6s
6-short signed vector
Definition Vector11T.hh:814
VectorT< signed int, 3 > Vec3i
3-int signed vector
Definition Vector11T.hh:765
Definition Vector11T.hh:83
vector_type & vectorize(const Scalar &_s)
store the same value in each component (e.g. to clear all entries)
Definition Vector11T.hh:613
const Scalar & operator[](size_t _i) const
get i'th element read-only
Definition Vector11T.hh:207
VectorT(Iterator it)
construct from a value array or any other iterator
Definition Vector11T.hh:166
Scalar dot(const VectorT< Scalar, DIM > &_v1, const VectorT< Scalar, DIM > &_v2)
symmetric version of the dot product
Definition Vector11T.hh:699
Scalar * data()
access to Scalar array
Definition Vector11T.hh:193
auto operator*(const VectorT< OtherScalar, DIM > &_rhs) const -> typename std::enable_if< sizeof(decltype(this->values_[0] **_rhs.data())) >=0
component-wise vector multiplication
auto operator+(const VectorT< OtherScalar, DIM > &_rhs) const -> typename std::enable_if< sizeof(decltype(this->values_[0]+ *_rhs.data())) >=0
component-wise vector addition
VectorT< Scalar, DIM > vector_type
Definition Vector11T.hh:99
static constexpr int dim()
returns dimension of the vector (deprecated)
Definition Vector11T.hh:102
decltype(std::declval< S >() *std::declval< S >()) sqrnorm() const
compute squared euclidean norm
Definition Vector11T.hh:396
static constexpr size_t size()
returns dimension of the vector
Definition Vector11T.hh:107
const Scalar * data() const
access to const Scalar array
Definition Vector11T.hh:196
void swap(VectorT &_other) noexcept(noexcept(std::swap(values_, _other.values_)))
swap with another vector
Definition Vector11T.hh:631
Scalar max_abs() const
return the maximal absolute component
Definition Vector11T.hh:497
vector_type min(const vector_type &_rhs) const
component-wise min
Definition Vector11T.hh:590
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
Definition Vector11T.hh:562
auto cross(const VectorT< LScalar, DIM > &_v1, const VectorT< RScalar, DIM > &_v2) -> decltype(_v1 % _v2)
symmetric version of the cross product
Definition Vector11T.hh:707
auto operator|(const VectorT< OtherScalar, DIM > &_rhs) const -> decltype(*this->data() **_rhs.data())
compute scalar product
Definition Vector11T.hh:382
auto operator-(const VectorT< OtherScalar, DIM > &_rhs) const -> typename std::enable_if< sizeof(decltype(this->values_[0] - *_rhs.data())) >=0
component-wise vector difference
void swap(VectorT< Scalar, DIM > &_v1, VectorT< Scalar, DIM > &_v2) noexcept(noexcept(_v1.swap(_v2)))
non-member swap
Definition Vector11T.hh:715
auto operator-=(const VectorT< OtherScalar, DIM > &_rhs) -> typename std::enable_if< sizeof(decltype(this->values_[0] - *_rhs.data())) >=0
vector difference from this
auto operator*=(const VectorT< OtherScalar, DIM > &_rhs) -> typename std::enable_if< sizeof(decltype(this->values_[0] **_rhs.data())) >=0
component-wise self-multiplication
auto operator/=(const OtherScalar &_s) -> typename std::enable_if< std::is_convertible< decltype(this->values_[0]/_s), Scalar >::value, VectorT< Scalar, DIM > & >::type
component-wise self-division by scalar
Definition Vector11T.hh:240
vector_type max(const vector_type &_rhs) const
component-wise max
Definition Vector11T.hh:595
vector_type & operator=(const VectorT< OtherScalar, DIM > &_rhs)
cast from vector with a different scalar type
Definition Vector11T.hh:184
auto operator/=(const VectorT< OtherScalar, DIM > &_rhs) -> typename std::enable_if< sizeof(decltype(this->values_[0]/*_rhs.data())) >=0
component-wise self-division
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
Definition Vector11T.hh:534
static vector_type vectorized(const Scalar &_s)
store the same value in each component
Definition Vector11T.hh:619
Scalar l8_norm() const
compute l8_norm
Definition Vector11T.hh:480
Scalar min_abs() const
return the minimal absolute component
Definition Vector11T.hh:511
VectorT(const Scalar &v)
Creates a vector with all components set to v.
Definition Vector11T.hh:132
auto length() const -> decltype(std::declval< VectorT< S, DIM > >().norm())
compute squared euclidean norm
Definition Vector11T.hh:417
auto operator/(const VectorT< OtherScalar, DIM > &_rhs) const -> typename std::enable_if< sizeof(decltype(this->values_[0]/*_rhs.data())) >=0
component-wise vector division
vector_type operator-(void) const
unary minus
Definition Vector11T.hh:357
bool operator<(const vector_type &_rhs) const
lexicographical comparison
Definition Vector11T.hh:624
bool minimized(const vector_type &_rhs)
minimize values and signalize coordinate minimization
Definition Vector11T.hh:545
auto homogenized() const -> typename std::enable_if< D==4, VectorT< decltype(std::declval< S >()/std::declval< S >()), DIM > >::type
Only for 4-component vectors with division operator on their Scalar: Dehomogenization.
Definition Vector11T.hh:146
Scalar mean_abs() const
return absolute arithmetic mean
Definition Vector11T.hh:525
Scalar l1_norm() const
compute L1 (Manhattan) norm
Definition Vector11T.hh:474
Scalar value_type
Definition Vector11T.hh:96
VectorT(const VectorT< otherScalarType, DIM > &_rhs)
copy & cast constructor (explicit)
Definition Vector11T.hh:174
Scalar mean() const
return arithmetic mean
Definition Vector11T.hh:520
auto operator*=(const OtherScalar &_s) -> typename std::enable_if< std::is_convertible< decltype(this->values_[0] *_s), Scalar >::value, VectorT< Scalar, DIM > & >::type
component-wise self-multiplication with scalar
Definition Vector11T.hh:228
auto operator+=(const VectorT< OtherScalar, DIM > &_rhs) -> typename std::enable_if< sizeof(decltype(this->values_[0]+ *_rhs.data())) >=0
vector self-addition
constexpr VectorT()
default constructor creates uninitialized values.
Definition Vector11T.hh:127
vector_type apply(const Functor &_func) const
component-wise apply function object with Scalar operator()(Scalar).
Definition Vector11T.hh:605
bool operator==(const vector_type &_rhs) const
component-wise comparison
Definition Vector11T.hh:215
bool operator!=(const vector_type &_rhs) const
component-wise comparison
Definition Vector11T.hh:220
Scalar max() const
return the maximal component
Definition Vector11T.hh:492
bool maximized(const vector_type &_rhs)
maximize values and signalize coordinate maximization
Definition Vector11T.hh:573
auto normalize() -> decltype(*this/=std::declval< VectorT< S, DIM > >().norm())
normalize vector, return normalized vector
Definition Vector11T.hh:428
Scalar & operator[](size_t _i)
get i'th element read-write
Definition Vector11T.hh:201
auto norm() const -> decltype(std::sqrt(std::declval< VectorT< S, DIM > >().sqrnorm()))
compute euclidean norm
Definition Vector11T.hh:408
std::enable_if< sizeof(decltype(static_cast< S >(0), std::declval< VectorT< S, DIM > >().norm()))>=0, vector_type & >::type normalize_cond()
normalize vector, return normalized vector and avoids div by zero
Definition Vector11T.hh:455
Scalar min() const
return the minimal component
Definition Vector11T.hh:506
auto normalized() const -> decltype(*this/std::declval< VectorT< S, DIM > >().norm())
return normalized vector
Definition Vector11T.hh:439
auto operator%(const VectorT< OtherScalar, DIM > &_rhs) const -> typename std::enable_if< DIM==3, VectorT< decltype((*this)[0] *_rhs[0] -(*this)[0] *_rhs[0]), DIM > >::type
cross product: only defined for Vec3* as specialization
Definition Vector11T.hh:367