Skip to content

Commit

Permalink
GetDistance not static.
Browse files Browse the repository at this point in the history
  • Loading branch information
devw4r committed Jul 23, 2024
1 parent c9aa8c3 commit 203e294
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pathfind/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ bool Map::FindPointInBetweenVectors(const math::Vertex& start, const math::Verte
const float distance,
math::Vertex& inBetweenPoint) const
{
const float generalDistance = math::Vector3::GetDistance(start, end);
const float generalDistance = start.GetDistance(end);
if (generalDistance < distance) {
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions utility/Vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Vector3 Vector3::CrossProduct(const Vector3& a, const Vector3& b)
a.X * b.Y - a.Y * b.X);
}

float Vector3::GetDistance(const Vector3& a, const Vector3& b)
float Vector3::GetDistance(const Vector3& other) const
{
return sqrtf(powf((a.X - b.X), 2) + powf((a.Y - b.Y), 2) +
powf((a.Z - b.Z), 2));
return sqrtf(powf((X - other.X), 2) + powf((Y - other.Y), 2) +
powf((Z - other.Z), 2));
}

Vector3 Vector3::Normalize(const Vector3& a)
Expand Down
2 changes: 1 addition & 1 deletion utility/Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct Vector3
static Vector3 CrossProduct(const Vector3& a, const Vector3& b);
static Vector3 Normalize(const Vector3& a);
static Vector3 Transform(const Vector3& position, const Matrix& matrix);
static float GetDistance(const Vector3& a, const Vector3& b);
float GetDistance(const Vector3& other) const;

float X;
float Y;
Expand Down

0 comments on commit 203e294

Please sign in to comment.