circle.h 796 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * 2D Physic Engine
  3. * circle.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 18/07/2022.
  8. */
  9. #ifndef PHYSICENGINE_SHAPE_CIRCLE_H
  10. #define PHYSICENGINE_SHAPE_CIRCLE_H
  11. #include <physics/shape.h>
  12. struct circleShape: public shape
  13. {
  14. double radius;
  15. circleShape() = default;
  16. circleShape(const double radius) : radius(radius) {};
  17. virtual ~circleShape() = default;
  18. shapeType getType() const override
  19. {
  20. return SHAPE_CIRCLE;
  21. }
  22. double getMomentOfInertial() const override
  23. {
  24. return 0.0;
  25. };
  26. shape *clone() const override
  27. {
  28. return new circleShape(this->radius);
  29. };
  30. };
  31. #endif /* PHYSICENGINE_SHAPE_CIRCLE_H */