Mass.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_PHYSICS_MASS_H
#define SURGSIM_PHYSICS_MASS_H
namespace SurgSim
{
namespace Physics
{
// Class to handle a mass of a MassSpring node
class Mass
{
public:
explicit Mass(double mass = 0.0) : m_mass(mass)
{
}
void setMass(double mass)
{
m_mass = mass;
}
double getMass() const
{
return m_mass;
}
bool operator ==(const Mass& m) const
{
return (m_mass == m.m_mass);
}
bool operator !=(const Mass& m) const
{
return ! ((*this) == m);
}
protected:
double m_mass;
};
} // namespace Physics
} // namespace SurgSim
#endif // SURGSIM_PHYSICS_MASS_H
SurgSim::Physics::Mass
Definition: Mass.h:26
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Physics::Mass::Mass
Mass(double mass=0.0)
Constructor.
Definition: Mass.h:31
SurgSim::Physics::Mass::operator==
bool operator==(const Mass &m) const
Comparison operator (equality)
Definition: Mass.h:52
SurgSim::Physics::Mass::m_mass
double m_mass
Mass (in kg)
Definition: Mass.h:67
SurgSim::Physics::Mass::getMass
double getMass() const
Gets the mass.
Definition: Mass.h:44
SurgSim::Physics::Mass::operator!=
bool operator!=(const Mass &m) const
Comparison operator (inequality)
Definition: Mass.h:60
SurgSim::Physics::Mass::setMass
void setMass(double mass)
Sets the mass.
Definition: Mass.h:37