force.h 897 B

123456789101112131415161718192021222324252627
  1. /*
  2. * 2D Physic Engine
  3. * force.h:
  4. * Based on pikuma.com Learn Game Physics Engine Programming course.
  5. * Copyright (c) 2022 986-Studio. All rights reserved.
  6. *
  7. * Created by Manoël Trapier on 17/06/2022.
  8. */
  9. #ifndef PHYSICENGINE_FORCE_H
  10. #define PHYSICENGINE_FORCE_H
  11. #include <physics/vec2.h>
  12. #include <physics/body.h>
  13. class force
  14. {
  15. public:
  16. static vec2 generateFrictionForce(const body &bodyRef, double k);
  17. static vec2 generateDragForce(const body &bodyRef, double k);
  18. static vec2 generateGravitationalForce(const body &a, const body &b, double g,
  19. double minDistance = 0, double maxDistance = INFINITY);
  20. static vec2 generateSpringForce(const body &body, vec2 anchor, double restLength, double k);
  21. static vec2 generateSpringForce(const body &a, const body & b, double restLength, double k);
  22. };
  23. #endif /* PHYSICENGINE_FORCE_H */