Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Vector11T.hh
1 /* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openmesh.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenMesh. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 * ========================================================================= */
41
42 #ifndef OPENMESH_SRC_OPENMESH_CORE_GEOMETRY_VECTOR11T_HH_
43 #define OPENMESH_SRC_OPENMESH_CORE_GEOMETRY_VECTOR11T_HH_
44
45 #include <array>
46 #include <utility>
47 #include <algorithm>
48 #include <numeric>
49 #include <type_traits>
50 #include <cmath>
51 #include <ostream>
52 #include <istream>
53 #include <cassert>
54 #include <cstdlib>
55
56 // This header is not needed by this file but expected by others including
57 // this file.
58 #include <OpenMesh/Core/System/config.h>
59
60
61 /*
62 * Helpers for VectorT
63 */
64 namespace {
65
66 template<typename ... Ts>
67 struct are_convertible_to;
68
69 template<typename To, typename From, typename ... Froms>
70 struct are_convertible_to<To, From, Froms...> {
71 static constexpr bool value = std::is_convertible<From, To>::value
72 && are_convertible_to<To, Froms...>::value;
73 };
74
75 template<typename To, typename From>
76 struct are_convertible_to<To, From> : public std::is_convertible<From, To> {
77 };
78 }
79
80 namespace OpenMesh {
81
82 template<typename Scalar, int DIM>
83 class VectorT {
84
85 static_assert(DIM >= 1, "VectorT requires positive dimensionality.");
86
87 private:
88 using container = std::array<Scalar, DIM>;
89 container values_;
90
91 public:
92
93 //---------------------------------------------------------------- class info
94
96 typedef Scalar value_type;
97
99 typedef VectorT<Scalar, DIM> vector_type;
100
102 static constexpr int dim() {
103 return DIM;
104 }
105
107 static constexpr size_t size() {
108 return DIM;
109 }
110
111 static constexpr const size_t size_ = DIM;
112
113 //-------------------------------------------------------------- constructors
114
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.");
124 }
125
127 constexpr VectorT() {}
128
132 explicit VectorT(const Scalar &v) {
133 vectorize(v);
134 }
135
136 VectorT(const VectorT &rhs) = default;
137 VectorT(VectorT &&rhs) = default;
138 VectorT &operator=(const VectorT &rhs) = default;
139 VectorT &operator=(VectorT &&rhs) = default;
140
145 template<typename S = Scalar, int D = DIM>
146 auto homogenized() const ->
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 "
153 "arguments.)");
154 return VectorT(
155 values_[0]/values_[3],
156 values_[1]/values_[3],
157 values_[2]/values_[3],
158 1);
159 }
160
162 template<typename Iterator,
163 typename = decltype(
164 *std::declval<Iterator&>(), void(),
165 ++std::declval<Iterator&>(), void())>
166 explicit VectorT(Iterator it) {
167 std::copy_n(it, DIM, values_.begin());
168 }
169
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) {
175 operator=(_rhs);
176 }
177
178 //--------------------------------------------------------------------- casts
179
181 template<typename OtherScalar,
182 typename = typename std::enable_if<
183 std::is_convertible<OtherScalar, Scalar>::value>>
184 vector_type& operator=(const VectorT<OtherScalar, DIM>& _rhs) {
185 std::transform(_rhs.data(), _rhs.data() + DIM,
186 data(), [](OtherScalar rhs) {
187 return static_cast<Scalar>(std::move(rhs));
188 });
189 return *this;
190 }
191
193 Scalar* data() { return values_.data(); }
194
196 const Scalar *data() const { return values_.data(); }
197
198 //----------------------------------------------------------- element access
199
201 Scalar& operator[](size_t _i) {
202 assert(_i < DIM);
203 return values_[_i];
204 }
205
207 const Scalar& operator[](size_t _i) const {
208 assert(_i < DIM);
209 return values_[_i];
210 }
211
212 //---------------------------------------------------------------- comparsion
213
215 bool operator==(const vector_type& _rhs) const {
216 return std::equal(_rhs.values_.cbegin(), _rhs.values_.cend(), values_.cbegin());
217 }
218
220 bool operator!=(const vector_type& _rhs) const {
221 return !std::equal(_rhs.values_.cbegin(), _rhs.values_.cend(), values_.cbegin());
222 }
223
224 //---------------------------------------------------------- scalar operators
225
227 template<typename OtherScalar>
228 auto operator*=(const OtherScalar& _s) ->
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) {
233 e *= _s;
234 }
235 return *this;
236 }
237
239 template<typename OtherScalar>
240 auto operator/=(const OtherScalar& _s) ->
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) {
245 e /= _s;
246 }
247 return *this;
248 }
249
251 template<typename OtherScalar>
252 typename std::enable_if<std::is_convertible<
253 decltype(std::declval<Scalar>() * std::declval<OtherScalar>()),
254 Scalar>::value,
255 VectorT<Scalar, DIM>>::type
256 operator*(const OtherScalar& _s) const {
257 return vector_type(*this) *= _s;
258 }
259
261 template<typename OtherScalar>
262 typename std::enable_if<std::is_convertible<
263 decltype(std::declval<Scalar>() / std::declval<OtherScalar>()),
264 Scalar>::value,
265 VectorT<Scalar, DIM>>::type
266 operator/(const OtherScalar& _s) const {
267 return vector_type(*this) /= _s;
268 }
269
270 //---------------------------------------------------------- vector operators
271
273 template<typename OtherScalar>
274 auto operator*=(const VectorT<OtherScalar, DIM>& _rhs) ->
275 typename std::enable_if<
276 sizeof(decltype(this->values_[0] * *_rhs.data())) >= 0,
277 vector_type&>::type {
278 for (int i = 0; i < DIM; ++i) {
279 data()[i] *= _rhs.data()[i];
280 }
281 return *this;
282 }
283
285 template<typename OtherScalar>
286 auto operator/=(const VectorT<OtherScalar, DIM>& _rhs) ->
287 typename std::enable_if<
288 sizeof(decltype(this->values_[0] / *_rhs.data())) >= 0,
289 vector_type&>::type {
290 for (int i = 0; i < DIM; ++i) {
291 data()[i] /= _rhs.data()[i];
292 }
293 return *this;
294 }
295
297 template<typename OtherScalar>
298 auto operator-=(const VectorT<OtherScalar, DIM>& _rhs) ->
299 typename std::enable_if<
300 sizeof(decltype(this->values_[0] - *_rhs.data())) >= 0,
301 vector_type&>::type {
302 for (int i = 0; i < DIM; ++i) {
303 data()[i] -= _rhs.data()[i];
304 }
305 return *this;
306 }
307
309 template<typename OtherScalar>
310 auto operator+=(const VectorT<OtherScalar, DIM>& _rhs) ->
311 typename std::enable_if<
312 sizeof(decltype(this->values_[0] + *_rhs.data())) >= 0,
313 vector_type&>::type {
314 for (int i = 0; i < DIM; ++i) {
315 data()[i] += _rhs.data()[i];
316 }
317 return *this;
318 }
319
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,
325 vector_type>::type {
326 return vector_type(*this) *= _rhs;
327 }
328
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,
334 vector_type>::type {
335 return vector_type(*this) /= _rhs;
336 }
337
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,
343 vector_type>::type {
344 return vector_type(*this) += _rhs;
345 }
346
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,
352 vector_type>::type {
353 return vector_type(*this) -= _rhs;
354 }
355
357 vector_type operator-(void) const {
358 vector_type v;
359 std::transform(values_.begin(), values_.end(), v.values_.begin(),
360 [](const Scalar &s) { return -s; });
361 return v;
362 }
363
366 template<typename OtherScalar>
367 auto operator% (const VectorT<OtherScalar, DIM> &_rhs) const ->
368 typename std::enable_if<DIM == 3,
369 VectorT<decltype(this->values_[0] * _rhs[0] -
370 this->values_[0] * _rhs[0]),
371 DIM>>::type {
372 return {
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]
376 };
377 }
378
381 template<typename OtherScalar>
382 auto operator|(const VectorT<OtherScalar, DIM>& _rhs) const ->
383 decltype(*this->data() * *_rhs.data()) {
384
385 return std::inner_product(data() + 1, data() + DIM, _rhs.data() + 1,
386 *data() * *_rhs.data());
387 }
388
389 //------------------------------------------------------------ euclidean norm
390
392
393
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 "
399 "arguments.)");
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; });
404 }
405
407 template<typename S = Scalar>
408 auto norm() const ->
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 "
412 "arguments.)");
413 return std::sqrt(sqrnorm());
414 }
415
416 template<typename S = Scalar>
417 auto length() const ->
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 "
421 "arguments.)");
422 return norm();
423 }
424
427 template<typename S = Scalar>
428 auto normalize() ->
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 "
432 "arguments.)");
433 return *this /= norm();
434 }
435
438 template<typename S = Scalar>
439 auto normalized() const ->
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 "
443 "arguments.)");
444 return *this / norm();
445 }
446
449 template<typename S = Scalar>
450 typename std::enable_if<
451 sizeof(decltype(
452 static_cast<S>(0),
453 std::declval<VectorT<S, DIM>>().norm())) >= 0,
454 vector_type&>::type
455 normalize_cond() {
456 static_assert(std::is_same<S, Scalar>::value, "S and Scalar need "
457 "to be the same type. (Never override the default template "
458 "arguments.)");
459 auto n = norm();
460 if (n != static_cast<decltype(norm())>(0)) {
461 *this /= n;
462 }
463 return *this;
464 }
465
467
468 //------------------------------------------------------------ euclidean norm
469
471
472
474 Scalar l1_norm() const {
475 return std::accumulate(
476 values_.cbegin() + 1, values_.cend(), values_[0]);
477 }
478
480 Scalar l8_norm() const {
481 return max_abs();
482 }
483
485
486 //------------------------------------------------------------ max, min, mean
487
489
490
492 Scalar max() const {
493 return *std::max_element(values_.cbegin(), values_.cend());
494 }
495
497 Scalar max_abs() const {
498 return std::abs(
499 *std::max_element(values_.cbegin(), values_.cend(),
500 [](const Scalar &a, const Scalar &b) {
501 return std::abs(a) < std::abs(b);
502 }));
503 }
504
506 Scalar min() const {
507 return *std::min_element(values_.cbegin(), values_.cend());
508 }
509
511 Scalar min_abs() const {
512 return std::abs(
513 *std::min_element(values_.cbegin(), values_.cend(),
514 [](const Scalar &a, const Scalar &b) {
515 return std::abs(a) < std::abs(b);
516 }));
517 }
518
520 Scalar mean() const {
521 return l1_norm()/DIM;
522 }
523
525 Scalar mean_abs() const {
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);
530 }) / DIM;
531 }
532
534 vector_type& minimize(const vector_type& _rhs) {
535 std::transform(values_.cbegin(), values_.cend(),
536 _rhs.values_.cbegin(),
537 values_.begin(),
538 [](const Scalar &l, const Scalar &r) {
539 return std::min(l, r);
540 });
541 return *this;
542 }
543
545 bool minimized(const vector_type& _rhs) {
546 bool result = false;
547 std::transform(values_.cbegin(), values_.cend(),
548 _rhs.values_.cbegin(),
549 values_.begin(),
550 [&result](const Scalar &l, const Scalar &r) {
551 if (l < r) {
552 return l;
553 } else {
554 result = true;
555 return r;
556 }
557 });
558 return result;
559 }
560
562 vector_type& maximize(const vector_type& _rhs) {
563 std::transform(values_.cbegin(), values_.cend(),
564 _rhs.values_.cbegin(),
565 values_.begin(),
566 [](const Scalar &l, const Scalar &r) {
567 return std::max(l, r);
568 });
569 return *this;
570 }
571
573 bool maximized(const vector_type& _rhs) {
574 bool result = false;
575 std::transform(values_.cbegin(), values_.cend(),
576 _rhs.values_.cbegin(),
577 values_.begin(),
578 [&result](const Scalar &l, const Scalar &r) {
579 if (l > r) {
580 return l;
581 } else {
582 result = true;
583 return r;
584 }
585 });
586 return result;
587 }
588
590 inline vector_type min(const vector_type& _rhs) const {
591 return vector_type(*this).minimize(_rhs);
592 }
593
595 inline vector_type max(const vector_type& _rhs) const {
596 return vector_type(*this).maximize(_rhs);
597 }
598
600
601 //------------------------------------------------------------ misc functions
602
604 template<typename Functor>
605 inline vector_type apply(const Functor& _func) const {
606 vector_type result;
607 std::transform(result.values_.begin(), result.values_.end(),
608 result.values_.begin(), _func);
609 return result;
610 }
611
613 vector_type& vectorize(const Scalar& _s) {
614 std::fill(values_.begin(), values_.end(), _s);
615 return *this;
616 }
617
619 static vector_type vectorized(const Scalar& _s) {
620 return vector_type().vectorize(_s);
621 }
622
624 bool operator<(const vector_type& _rhs) const {
625 return std::lexicographical_compare(
626 values_.begin(), values_.end(),
627 _rhs.values_.begin(), _rhs.values_.end());
628 }
629
631 void swap(VectorT& _other)
632 noexcept(noexcept(std::swap(values_, _other.values_))) {
633 std::swap(values_, _other.values_);
634 }
635
636 //------------------------------------------------------------ component iterators
637
639
640
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;
645
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(); }
649
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(); }
653
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(); }
657
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(); }
661
663 };
664
666 template<typename Scalar, int DIM, typename OtherScalar>
667 auto operator*(const OtherScalar& _s, const VectorT<Scalar, DIM> &rhs) ->
668 decltype(rhs.operator*(_s)) {
669
670 return rhs * _s;
671 }
672
674 template<typename Scalar, int DIM>
675 auto operator<<(std::ostream& os, const VectorT<Scalar, DIM> &_vec) ->
676 typename std::enable_if<
677 sizeof(decltype(os << _vec[0])) >= 0, std::ostream&>::type {
678
679 os << _vec[0];
680 for (int i = 1; i < DIM; ++i) {
681 os << " " << _vec[i];
682 }
683 return os;
684 }
685
687 template<typename Scalar, int DIM>
688 auto operator>> (std::istream& is, VectorT<Scalar, DIM> &_vec) ->
689 typename std::enable_if<
690 sizeof(decltype(is >> _vec[0])) >= 0, std::istream &>::type {
691 for (int i = 0; i < DIM; ++i)
692 is >> _vec[i];
693 return is;
694 }
695
698 template<typename Scalar, int DIM>
699 Scalar dot(const VectorT<Scalar, DIM>& _v1, const VectorT<Scalar, DIM>& _v2) {
700 return (_v1 | _v2);
701 }
702
705 template<typename LScalar, typename RScalar, int DIM>
706 auto
707 cross(const VectorT<LScalar, DIM>& _v1, const VectorT<RScalar, DIM>& _v2) ->
708 decltype(_v1 % _v2) {
709 return (_v1 % _v2);
710 }
711
714 template<typename Scalar, int DIM>
715 void swap(VectorT<Scalar, DIM>& _v1, VectorT<Scalar, DIM>& _v2)
716 noexcept(noexcept(_v1.swap(_v2))) {
717 _v1.swap(_v2);
718 }
719
720 //== TYPEDEFS =================================================================
721
723 typedef VectorT<signed char,1> Vec1c;
725 typedef VectorT<unsigned char,1> Vec1uc;
727 typedef VectorT<signed short int,1> Vec1s;
729 typedef VectorT<unsigned short int,1> Vec1us;
731 typedef VectorT<signed int,1> Vec1i;
733 typedef VectorT<unsigned int,1> Vec1ui;
735 typedef VectorT<float,1> Vec1f;
737 typedef VectorT<double,1> Vec1d;
738
740 typedef VectorT<signed char,2> Vec2c;
742 typedef VectorT<unsigned char,2> Vec2uc;
744 typedef VectorT<signed short int,2> Vec2s;
746 typedef VectorT<unsigned short int,2> Vec2us;
748 typedef VectorT<signed int,2> Vec2i;
750 typedef VectorT<unsigned int,2> Vec2ui;
752 typedef VectorT<float,2> Vec2f;
754 typedef VectorT<double,2> Vec2d;
755
757 typedef VectorT<signed char,3> Vec3c;
759 typedef VectorT<unsigned char,3> Vec3uc;
761 typedef VectorT<signed short int,3> Vec3s;
763 typedef VectorT<unsigned short int,3> Vec3us;
765 typedef VectorT<signed int,3> Vec3i;
767 typedef VectorT<unsigned int,3> Vec3ui;
769 typedef VectorT<float,3> Vec3f;
771 typedef VectorT<double,3> Vec3d;
773 typedef VectorT<bool,3> Vec3b;
774
776 typedef VectorT<signed char,4> Vec4c;
778 typedef VectorT<unsigned char,4> Vec4uc;
780 typedef VectorT<signed short int,4> Vec4s;
782 typedef VectorT<unsigned short int,4> Vec4us;
784 typedef VectorT<signed int,4> Vec4i;
786 typedef VectorT<unsigned int,4> Vec4ui;
788 typedef VectorT<float,4> Vec4f;
790 typedef VectorT<double,4> Vec4d;
791
793 typedef VectorT<signed char, 5> Vec5c;
795 typedef VectorT<unsigned char, 5> Vec5uc;
797 typedef VectorT<signed short int, 5> Vec5s;
799 typedef VectorT<unsigned short int, 5> Vec5us;
801 typedef VectorT<signed int, 5> Vec5i;
803 typedef VectorT<unsigned int, 5> Vec5ui;
805 typedef VectorT<float, 5> Vec5f;
807 typedef VectorT<double, 5> Vec5d;
808
810 typedef VectorT<signed char,6> Vec6c;
812 typedef VectorT<unsigned char,6> Vec6uc;
814 typedef VectorT<signed short int,6> Vec6s;
816 typedef VectorT<unsigned short int,6> Vec6us;
818 typedef VectorT<signed int,6> Vec6i;
820 typedef VectorT<unsigned int,6> Vec6ui;
822 typedef VectorT<float,6> Vec6f;
824 typedef VectorT<double,6> Vec6d;
825
826 } // namespace OpenMesh
827
836 constexpr OpenMesh::Vec4f operator"" _htmlColor(unsigned long long raw_color) {
837 return OpenMesh::Vec4f(
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);
842 }
843
844 #endif /* OPENMESH_SRC_OPENMESH_CORE_GEOMETRY_VECTOR11T_HH_ */
OpenMesh::Vec3d
VectorT< double, 3 > Vec3d
Definition: Vector11T.hh:771
OpenMesh::Vec2i
VectorT< signed int, 2 > Vec2i
Definition: Vector11T.hh:748
OpenMesh::Vec2uc
VectorT< unsigned char, 2 > Vec2uc
Definition: Vector11T.hh:742
OpenMesh::Vec4s
VectorT< signed short int, 4 > Vec4s
Definition: Vector11T.hh:780
OpenMesh::Vec1f
VectorT< float, 1 > Vec1f
Definition: Vector11T.hh:735
OpenMesh::Vec2c
VectorT< signed char, 2 > Vec2c
Definition: Vector11T.hh:740
OpenMesh::Vec6i
VectorT< signed int, 6 > Vec6i
Definition: Vector11T.hh:818
OpenMesh::Vec3b
VectorT< bool, 3 > Vec3b
Definition: Vector11T.hh:773
OpenMesh::Vec3i
VectorT< signed int, 3 > Vec3i
Definition: Vector11T.hh:765
OpenMesh::VectorT::swap
void swap(VectorT< Scalar, DIM > &_v1, VectorT< Scalar, DIM > &_v2) noexcept(noexcept(_v1.swap(_v2)))
Definition: Vector11T.hh:715
OpenMesh
Definition: MeshItems.hh:64
OpenMesh::Vec1c
VectorT< signed char, 1 > Vec1c
Definition: Vector11T.hh:723
VectorT
OpenMesh::Vec4i
VectorT< signed int, 4 > Vec4i
Definition: Vector11T.hh:784
OpenMesh::Vec1i
VectorT< signed int, 1 > Vec1i
Definition: Vector11T.hh:731
OpenMesh::Vec1uc
VectorT< unsigned char, 1 > Vec1uc
Definition: Vector11T.hh:725
OpenMesh::Vec1ui
VectorT< unsigned int, 1 > Vec1ui
Definition: Vector11T.hh:733
OpenMesh::Vec1d
VectorT< double, 1 > Vec1d
Definition: Vector11T.hh:737
OpenMesh::VectorT::operator*
VectorT< Scalar1, N > operator*(Scalar2 _s, const VectorT< Scalar1, N > &_v)
Definition: MeshNode2T.cc:254
OpenMesh::Vec6us
VectorT< unsigned short int, 6 > Vec6us
Definition: Vector11T.hh:816
OpenMesh::Vec3ui
VectorT< unsigned int, 3 > Vec3ui
Definition: Vector11T.hh:767
OpenMesh::Vec5d
VectorT< double, 5 > Vec5d
Definition: Vector11T.hh:807
OpenMesh::Vec6uc
VectorT< unsigned char, 6 > Vec6uc
Definition: Vector11T.hh:812
OpenMesh::operator>>
auto operator>>(std::istream &is, VectorT< Scalar, DIM > &_vec) -> typename std::enable_if< sizeof(decltype(is >> _vec[0])) >=0
read the space-separated components of a vector from a stream
Definition: VectorT.hh:640
OpenMesh::Vec1us
VectorT< unsigned short int, 1 > Vec1us
Definition: Vector11T.hh:729
OpenMesh::Vec5uc
VectorT< unsigned char, 5 > Vec5uc
Definition: Vector11T.hh:795
OpenMesh::Vec5i
VectorT< signed int, 5 > Vec5i
Definition: Vector11T.hh:801
config.h
OpenMesh::Vec2f
VectorT< float, 2 > Vec2f
Definition: Vector11T.hh:752
OpenMesh::Vec2ui
VectorT< unsigned int, 2 > Vec2ui
Definition: Vector11T.hh:750
OpenMesh::Vec2s
VectorT< signed short int, 2 > Vec2s
Definition: Vector11T.hh:744
OpenMesh::Vec6ui
VectorT< unsigned int, 6 > Vec6ui
Definition: Vector11T.hh:820
OpenMesh::VectorT
Definition: Vector11T.hh:83
OpenMesh::Vec6s
VectorT< signed short int, 6 > Vec6s
Definition: Vector11T.hh:814
OpenMesh::Vec3s
VectorT< signed short int, 3 > Vec3s
Definition: Vector11T.hh:761
OpenMesh::Vec3c
VectorT< signed char, 3 > Vec3c
Definition: Vector11T.hh:757
OpenMesh::VectorT::cross
auto cross(const VectorT< LScalar, DIM > &_v1, const VectorT< RScalar, DIM > &_v2) -> decltype(_v1%_v2)
Definition: Vector11T.hh:707
OpenMesh::VectorT::dot
Scalar dot(const VectorT< Scalar, DIM > &_v1, const VectorT< Scalar, DIM > &_v2)
Definition: Vector11T.hh:699
OpenMesh::Vec4d
VectorT< double, 4 > Vec4d
Definition: Vector11T.hh:790
OpenMesh::Vec4uc
VectorT< unsigned char, 4 > Vec4uc
Definition: Vector11T.hh:778
OpenMesh::Vec6f
VectorT< float, 6 > Vec6f
Definition: Vector11T.hh:822
OpenMesh::Vec4us
VectorT< unsigned short int, 4 > Vec4us
Definition: Vector11T.hh:782
OpenMesh::Vec5c
VectorT< signed char, 5 > Vec5c
Definition: Vector11T.hh:793
OpenMesh::Vec3uc
VectorT< unsigned char, 3 > Vec3uc
Definition: Vector11T.hh:759
OpenMesh::Vec5ui
VectorT< unsigned int, 5 > Vec5ui
Definition: Vector11T.hh:803
OpenMesh::Vec4c
VectorT< signed char, 4 > Vec4c
Definition: Vector11T.hh:776
OpenMesh::Vec6c
VectorT< signed char, 6 > Vec6c
Definition: Vector11T.hh:810
OpenMesh::Vec2d
VectorT< double, 2 > Vec2d
Definition: Vector11T.hh:754
OpenMesh::Vec5s
VectorT< signed short int, 5 > Vec5s
Definition: Vector11T.hh:797
OpenMesh::Vec4ui
VectorT< unsigned int, 4 > Vec4ui
Definition: Vector11T.hh:786
OpenMesh::Vec3us
VectorT< unsigned short int, 3 > Vec3us
Definition: Vector11T.hh:763
OpenMesh::Vec2us
VectorT< unsigned short int, 2 > Vec2us
Definition: Vector11T.hh:746
OpenMesh::Vec3f
VectorT< float, 3 > Vec3f
Definition: Vector11T.hh:769
OpenMesh::Vec5f
VectorT< float, 5 > Vec5f
Definition: Vector11T.hh:805
OpenMesh::Vec5us
VectorT< unsigned short int, 5 > Vec5us
Definition: Vector11T.hh:799
OpenMesh::Vec1s
VectorT< signed short int, 1 > Vec1s
Definition: Vector11T.hh:727
OpenMesh::Vec4f
VectorT< float, 4 > Vec4f
Definition: Vector11T.hh:788
OpenMesh::Vec6d
VectorT< double, 6 > Vec6d
Definition: Vector11T.hh:824