Stowy Physics Engine 0.1.0
Loading...
Searching...
No Matches
Simplex.hpp
Go to the documentation of this file.
1
11#pragma once
12
13#include <array>
14
15#include "math/Vector2.hpp"
16
17namespace stw
18{
22struct Simplex
23{
27 static constexpr unsigned long long MAX_SIZE = 3ull;
28
30 : _points({Vector2(0, 0), {0, 0}, {0, 0}}), _size(0) {}
31
32 Simplex& operator=(std::initializer_list<Vector2> list);
33 Vector2 operator[](std::size_t i) const;
34
39 void PushFront(Vector2 point);
44 [[nodiscard]] std::size_t Size() const;
45 [[nodiscard]] std::array<Vector2, MAX_SIZE>::const_iterator Begin() const;
46 [[nodiscard]] std::array<Vector2, MAX_SIZE>::const_iterator End() const;
50 void IncrementSize();
51
52private:
53 std::array<Vector2, MAX_SIZE> _points;
54 std::size_t _size;
55};
56}
Contains the Vector2 struct.
Definition BroadPhaseGrid.hpp:18
Struct representing the simplest form that can "select" an area in any dimension.
Definition Simplex.hpp:23
std::size_t Size() const
Gets the size of the array.
Definition Simplex.cpp:29
Simplex()
Definition Simplex.hpp:29
void PushFront(Vector2 point)
Adds a point in the simplex.
Definition Simplex.cpp:23
std::array< Vector2, MAX_SIZE >::const_iterator Begin() const
Definition Simplex.cpp:44
Vector2 operator[](std::size_t i) const
Definition Simplex.cpp:18
void IncrementSize()
Increments the size of the simplex with a max at MAX_SIZE.
Definition Simplex.cpp:34
static constexpr unsigned long long MAX_SIZE
The max size of this simplex.
Definition Simplex.hpp:27
Simplex & operator=(std::initializer_list< Vector2 > list)
Definition Simplex.cpp:7
std::array< Vector2, MAX_SIZE >::const_iterator End() const
Definition Simplex.cpp:39
A struct representing a 2D Vector.
Definition Vector2.hpp:21