MorphoGraphX
SymmetricTensor.hpp
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef SYMMETRIC_TENSOR_HPP
12 #define SYMMETRIC_TENSOR_HPP
13 
14 #include <QTextStream>
15 #include <Vector.hpp>
16 
17 namespace mgx {
18 namespace util {
19 typedef Vector<3, float> Point3f;
20 
22 public:
24  : _ev1(1, 0, 0)
25  , _ev2(0, 1, 0)
26  , _evals(1, 1, 1)
27  {
28  }
29 
30  SymmetricTensor(const Point3f& ev1, const Point3f& ev2, const Point3f& evals)
31  : _ev1(ev1)
32  , _ev2(ev2)
33  , _evals(evals)
34  {
35  }
36 
37  SymmetricTensor(const SymmetricTensor& copy)
38  : _ev1(copy._ev1)
39  , _ev2(copy._ev2)
40  , _evals(copy._evals)
41  {
42  }
43 
44  SymmetricTensor& operator=(const SymmetricTensor& other)
45  {
46  _ev1 = other._ev1;
47  _ev2 = other._ev2;
48  _evals = other._evals;
49  return *this;
50  }
51 
52  Point3f& ev1() {
53  return _ev1;
54  }
55  Point3f& ev2() {
56  return _ev2;
57  }
58  const Point3f& ev1() const {
59  return _ev1;
60  }
61  const Point3f& ev2() const {
62  return _ev2;
63  }
64  Point3f ev3() const {
65  return _ev1 ^ _ev2;
66  }
67  const Point3f& evals() const {
68  return _evals;
69  }
70  Point3f& evals() {
71  return _evals;
72  }
73 
74 protected:
75  Point3f _ev1, _ev2;
76  Point3f _evals;
77 };
78 } // namespace util
79 } // namespace mgx
80 #endif
Definition: SymmetricTensor.hpp:21
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
Defines the Vector class template This file is shared by cuda, do not include headers that nvcc can&#39;t...