#include <cmath>

int sgn(double v) {
  return (v > 0) - (v < 0);
}

class Motion
{
    Axis * axisPtr;
    public:
    //Constructors:
    Motion();
    Motion(Axis * axis);
    
    //Methods:
    int step(float dt);

};

Motion::Motion()
{

}


Motion::Motion(Axis * axis)
{
    axisPtr = axis;
    return;
}


int Motion::step(float dt)
{
    axisPtr->timestamp += dt;
    axisPtr->pos += sgn(axisPtr->targetpos - axisPtr->pos) * axisPtr->v * dt;
    std::cout << axisPtr->pos << "\n";


    return 0;
}

