mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Updates simplex iterator and size access
Changes the index type for accessing simplex points to `std::size_t` for consistency and safety. Adds `[[nodiscard]]` attribute to `size()` and iterator functions to signal potential misuse and enable static analysis. These updates are part of the GJK algorithm implementation.
This commit is contained in:
@@ -34,20 +34,20 @@ namespace omath::collision
|
||||
m_size = std::min(m_size + 1, 4);
|
||||
}
|
||||
|
||||
Vector3<float>& operator[](const int i)
|
||||
Vector3<float>& operator[](const std::size_t i)
|
||||
{
|
||||
return m_points[i];
|
||||
}
|
||||
size_t size() const
|
||||
[[nodiscard]] std::size_t size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
auto begin() const
|
||||
[[nodiscard]] auto begin() const
|
||||
{
|
||||
return m_points.begin();
|
||||
}
|
||||
auto end() const
|
||||
[[nodiscard]] auto end() const
|
||||
{
|
||||
return m_points.end() - (4 - m_size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user