VPTissue Reference Manual
AreaMoment.h
Go to the documentation of this file.
1 #ifndef AREA_MOMENT_H_INCLUDED
2 #define AREA_MOMENT_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 namespace SimPT_Sim {
23 
27 struct AreaMoment
28 {
29  AreaMoment()
30  : m_xx(0.0), m_xy(0.0), m_yy(0.0)
31  {
32  }
33 
34  AreaMoment(double xx, double xy, double yy)
35  : m_xx(xx), m_xy(xy), m_yy(yy)
36  {
37  }
38 
39  AreaMoment& operator+=(const AreaMoment& rhs)
40  {
41  m_xx += rhs.m_xx; m_xy += rhs.m_xy; m_yy += rhs.m_yy;
42  return *this;
43  }
44 
45  AreaMoment& operator-=(const AreaMoment& rhs)
46  {
47  m_xx -= rhs.m_xx; m_xy -= rhs.m_xy; m_yy -= rhs.m_yy;
48  return *this;
49  }
50 
51  double m_xx;
52  double m_xy;
53  double m_yy;
54 };
55 
56 inline AreaMoment operator+(const AreaMoment& i1, const AreaMoment& i2)
57 {
58  return AreaMoment(i1.m_xx + i2.m_xx, i1.m_xy + i2.m_xy, i1.m_yy + i2.m_yy);
59 }
60 
61 inline AreaMoment operator-(const AreaMoment& i1, const AreaMoment& i2)
62 {
63  return AreaMoment(i1.m_xx - i2.m_xx, i1.m_xy - i2.m_xy, i1.m_yy - i2.m_yy);
64 }
65 
66 inline std::ostream& operator<<(std::ostream& os, const AreaMoment& i)
67 {
68  os << "AreaMoment: {" << std::endl;
69  os << "\t " << i.m_xx << " , " << i.m_xy << " , " << i.m_yy << std::endl;
70  os << "}";
71  return os;
72 }
73 
74 } // namespace
75 
76 #endif // end-of-include-guard
Namespace for the core simulator.
Structure with functionality for calculations of the area moment of inertia.
Definition: AreaMoment.h:27