From 70ea8877ace50d2ce609d7d5f721c887b0ea83ec Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Wed, 12 Aug 2020 14:13:50 -0600 Subject: Added files --- src/velocity.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/velocity.cpp (limited to 'src/velocity.cpp') diff --git a/src/velocity.cpp b/src/velocity.cpp new file mode 100644 index 0000000..ce739e3 --- /dev/null +++ b/src/velocity.cpp @@ -0,0 +1,58 @@ +#include "velocity.h" + +Velocity :: Velocity () +{ + setDx ( 0.0 ); + setDy ( 0.0 ); +} + +// Velocity constructor +Velocity :: Velocity ( float dx , float dy ) +{ + setDx ( dx ); + setDy ( dy ); +} + +// Get Velocity dx +float Velocity :: getDx() const +{ + return dx; +} + +// Get Velocity dy +float Velocity :: getDy() const +{ + return dy; +} + +// Set Velocity dx +void Velocity :: setDx( float dx ) +{ + this->dx = dx; +} + +// Set Velocity dy +void Velocity :: setDy( float dy ) +{ + this->dy = dy; +} + +// Add dy Velocity +void Velocity :: addDy ( const float dy ) +{ + this->dy += dy; +} + +// Add dx Velocity +void Velocity :: addDx ( const float dx ) +{ + this->dx += dx; +} + +// Update a point +Point Velocity :: updatePoint ( Point &point ) +{ + point.addX ( dx ); + point.addY ( dy ); + return point; +} -- cgit v1.2.3-70-g09d2