feature angle defaults to 20deg now
[engrid.git] / src / math / mathvector_structs.h
blobfe7b9ad6a1923a24441626c6b6e719729c131a6e
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008-2013 enGits GmbH +
7 // + +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
12 // + +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
17 // + +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 //
23 template <class T>
24 struct mv_p
26 static T apply(const T &a, const T &b) { return a+b; };
29 template <class T>
30 struct mv_m
32 static T apply(const T &a, const T &b) { return a-b; };
35 template <class T>
36 struct mv_ml
38 static T apply(const T &a, const T &b) { return a*b; };
41 template <class L, class O, class R>
42 struct ParseNode
44 typedef typename R::value_type value_type;
45 const L &l;
46 const R &r;
47 ParseNode(const L &a, const R &b) : l(a), r(b) {};
48 value_type operator[](const uint_t &i) const { return O::apply(l[i], r[i]); };
49 uint_t size() const { return r.size(); };
50 value_type abs() const;
51 value_type abs2() const;
54 template <class O, class R>
55 struct ParseNode<double, O, R>
57 typedef typename R::value_type value_type;
58 const double l;
59 const R &r;
60 ParseNode(const double a, const R &b) : l(a), r(b) {};
61 value_type operator[](const uint_t &i) const { return O::apply(l, r[i]); };
62 uint_t size() const { return r.size(); };
63 value_type abs() const;
64 value_type abs2() const;