12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /**
- * @file movement.h
- * @brief universal movement functions.
- */
- /**
- * @def MOVEMENT_H
- */
- #ifndef MOVEMENT_H
- #define MOVEMENT_H
- #define ASTEROID_SPEED_MAX 2.0f
- #define ASTEROID_SPEED_INIT 0.7f
- #define SPEED_INIT 0.5f
- #define SPEED_LIMIT_HIGH 4.0f
- #define SPEED_LIMIT_LOW 0.0f
- #define SPEED_LIMIT_EPSILON 0.0001f
- #define SPEED_STOP 0.1f
- #define SPEED_ACCEL 0.075f
- #define SPEED_BRAKE 0.033f
- #define SPEED_INERTION 0.008f
- #define SPEED_VECTOR_CHANGE 2.0f
- #define SPEED_BRAKE_VECTOR 2.315f
- #define TURN_RATE 0.06f
- /**
- * @fn forward(float *x, float *y, float speed, float heading)
- * moves the object forward
- * @param x - pointer to object's X position
- * @param y - pointer to object's Y position
- * @param speed - value how much to move the object on X and Y
- * @param heading - value where to move the objects
- */
- void forward(float *x, float *y, float speed, float heading);
- /**
- * @fn void backward(float *x, float *y, float speed, float heading)
- * moves the object forward(not error)
- * @param x - pointer to object's X position
- * @param y - pointer to object's Y position
- * @param speed - value how much to move the object on X and Y
- * @param heading - value where to move the objects
- */
- void backward(float *x, float *y, float speed, float heading);
- /**
- * @fn void accel(float *speed)
- * increase the speed of object by SPEED_ACCEL and check for limits.
- * @param speed - pointer to speed to change
- */
- void accel(float *speed);
- /**
- * @fn void brake(float *speed)
- * decrease the speed of object by SPEED_BRAKE and check for limits.
- * @param speed - pointer to value to change
- */
- void brake(float *speed);
- /**
- * @fn void inertion(float *speed)
- * decrease the speed of object by SPEED_INERTION and check for limits.
- * @param speed - pointer to value to change
- */
- void inertion(float *speed);
- /**
- * float normolize(float angle)
- * normolizes the angle between [-2/pi; 2/pi]
- * @param angle - angle to normolize
- * @return normolized angle
- */
- float normolize(float angle);
- /**
- * @fn float gelu(float x)
- * activation gelu function
- * @param x - takes in value to "activate"
- * @return new value between [-3;5]
- */
- float gelu(float x);
- /**
- * @fn void left(float *arg)
- * rotates object by TURN_RATE in CCW direction
- * @param arg - pointer to the objects current twist
- */
- void left(float *arg);
- /**
- * @fn void right(float *arg)
- * rotates object by TURN_RATE in CW direction
- * @param arg - pointer to the objects current twist
- */
- void right(float *arg);
- #endif /* MOVEMENT_H */
|