remove unnecessary method
This commit is contained in:
parent
afd46b5f07
commit
ffd4b59eca
@ -11,7 +11,7 @@ project(${PROJECT_NAME} VERSION ${PROJECT_VERSION})
|
||||
|
||||
##############################################################
|
||||
set(RAYLIB_DIR "/home/tuanpanda/Panda/04-WORKSPACE/00-PROGRAMMING/_Git Clone/raylib-4.5.0")
|
||||
set(IMGUI_DIR "/home/tuanpanda/Panda/04-WORKSPACE/00-PROGRAMMING/_Git Clone/imgui-1.89.7")
|
||||
set(IMGUI_DIR "/home/tuanpanda/Panda/04-WORKSPACE/00-PROGRAMMING/_Git Clone/imgui-docking")
|
||||
set(RLIMGUI_DIR "/home/tuanpanda/Panda/04-WORKSPACE/00-PROGRAMMING/_Git Clone/rlImGui")
|
||||
set(INIFILE_DIR "/home/tuanpanda/Panda/04-WORKSPACE/00-PROGRAMMING/_Git Clone/inifile-cpp")
|
||||
|
||||
@ -66,6 +66,7 @@ file(GLOB PROJECT_SOURCES CONFIGURE_DEPENDS
|
||||
"src/*.cpp"
|
||||
"src/**/*.cpp"
|
||||
"${imgui_SOURCE_DIR}/*.cpp"
|
||||
"${imgui_SOURCE_DIR}/misc/cpp/*.cpp"
|
||||
"${rlimgui_SOURCE_DIR}/*.cpp")
|
||||
|
||||
set(PROJECT_INCLUDE
|
||||
|
@ -11,6 +11,7 @@
|
||||
struct Texture;
|
||||
struct RenderTexture;
|
||||
struct Color;
|
||||
struct Vector2;
|
||||
|
||||
namespace panda
|
||||
{
|
||||
@ -49,4 +50,11 @@ namespace panda
|
||||
|
||||
// Utils
|
||||
Random &GetDefaultRandom();
|
||||
|
||||
// Euclidean Distance
|
||||
double distance(const Vector2 &p1, const Vector2 &p2);
|
||||
double distanceSqrt(const Vector2 &p1, const Vector2 &p2);
|
||||
|
||||
// Manhattan Distance
|
||||
double distanceManhattan(const Vector2 &p1, const Vector2 &p2);
|
||||
}
|
||||
|
22
src/utils/Distance.cpp
Normal file
22
src/utils/Distance.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "core/Panda.hpp"
|
||||
#include <cmath>
|
||||
#include <raylib.h>
|
||||
|
||||
double panda::distance(const Vector2 &p1, const Vector2 &p2)
|
||||
{
|
||||
double dx = p1.x - p2.x;
|
||||
double dy = p1.y - p2.y;
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
double panda::distanceSqrt(const Vector2 &p1, const Vector2 &p2)
|
||||
{
|
||||
double dx = p1.x - p2.x;
|
||||
double dy = p1.y - p2.y;
|
||||
return std::sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
double panda::distanceManhattan(const Vector2 &p1, const Vector2 &p2)
|
||||
{
|
||||
return std::abs(p1.x - p2.x) + std::abs(p1.y - p2.y);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user