mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 15:03:27 +00:00
added additional methods
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace omath::pathfinding
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "omath/pathfinding/NavigationMesh.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <algorithm>
|
||||
namespace omath::pathfinding
|
||||
{
|
||||
std::expected<Vector3, std::string> NavigationMesh::GetClossestVertex(const Vector3 &point) const
|
||||
@@ -26,6 +26,11 @@ namespace omath::pathfinding
|
||||
return m_verTextMap.at(vertex);
|
||||
}
|
||||
|
||||
bool NavigationMesh::Empty() const
|
||||
{
|
||||
return m_verTextMap.empty();
|
||||
}
|
||||
|
||||
std::vector<uint8_t> NavigationMesh::Serialize() const
|
||||
{
|
||||
auto dumpToVector =[]<typename T>(const T& t, std::vector<uint8_t>& vec){
|
||||
@@ -58,7 +63,7 @@ namespace omath::pathfinding
|
||||
{
|
||||
throw std::runtime_error("Deserialize: Invalid input data size.");
|
||||
}
|
||||
std::memcpy(&value, vec.data() + offset, sizeof(value));
|
||||
std::copy_n(vec.data() + offset, sizeof(value), (uint8_t*)&value);
|
||||
offset += sizeof(value);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user