opensurgsim
Mass.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_PHYSICS_MASS_H
17 #define SURGSIM_PHYSICS_MASS_H
18 
19 namespace SurgSim
20 {
21 
22 namespace Physics
23 {
24 
25 // Class to handle a mass of a MassSpring node
26 class Mass
27 {
28 public:
31  explicit Mass(double mass = 0.0) : m_mass(mass)
32  {
33  }
34 
37  void setMass(double mass)
38  {
39  m_mass = mass;
40  }
41 
44  double getMass() const
45  {
46  return m_mass;
47  }
48 
52  bool operator ==(const Mass& m) const
53  {
54  return (m_mass == m.m_mass);
55  }
56 
60  bool operator !=(const Mass& m) const
61  {
62  return ! ((*this) == m);
63  }
64 
65 protected:
67  double m_mass;
68 };
69 
70 } // namespace Physics
71 
72 } // namespace SurgSim
73 
74 #endif // SURGSIM_PHYSICS_MASS_H
Definition: Mass.h:26
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Mass(double mass=0.0)
Constructor.
Definition: Mass.h:31
bool operator==(const Mass &m) const
Comparison operator (equality)
Definition: Mass.h:52
double m_mass
Mass (in kg)
Definition: Mass.h:67
double getMass() const
Gets the mass.
Definition: Mass.h:44
bool operator!=(const Mass &m) const
Comparison operator (inequality)
Definition: Mass.h:60
void setMass(double mass)
Sets the mass.
Definition: Mass.h:37