ConvexHullTest.h 834 B

12345678910111213141516171819202122232425262728293031
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Tests/Test.h>
  6. // Simple test to create a convex hull
  7. class ConvexHullTest : public Test
  8. {
  9. public:
  10. JPH_DECLARE_RTTI_VIRTUAL(JPH_NO_EXPORT, ConvexHullTest)
  11. // Initialize the test
  12. virtual void Initialize() override;
  13. // Update the test, called before the physics update
  14. virtual void PrePhysicsUpdate(const PreUpdateParams &inParams) override;
  15. private:
  16. // A list of predefined points to feed the convex hull algorithm
  17. using Points = Array<Vec3>;
  18. Array<Points> mPoints;
  19. // Which index in the list we're currently using
  20. size_t mIteration = 0;
  21. // If we run out of points, we start creating random points
  22. default_random_engine mRandom { 12345 };
  23. };