Fix some declarations and pointer madness in Vec3SqrDist

This commit is contained in:
Louvenarde
2021-12-13 18:46:55 +01:00
parent 6d70cd3e74
commit d726015ba2
3 changed files with 23 additions and 22 deletions

View File

@ -150,11 +150,11 @@ namespace Utils
return !(base1 + len1 <= base2 || base2 + len2 <= base1);
}
float Vec3SqrDistance(float(*v1)[3], float(*v2)[3])
float Vec3SqrDistance(const float v1[3], const float v2[3])
{
auto x = (*v2)[0] - (*v1)[0];
auto y = (*v2)[1] - (*v1)[1];
auto z = (*v2)[2] - (*v1)[2];
auto x = v2[0] - v1[0];
auto y = v2[1] - v1[1];
auto z = v2[2] - v1[2];
return x * x + y * y + z * z;
}

View File

@ -24,7 +24,7 @@ namespace Utils
void OpenUrl(const std::string& url);
bool HasIntercection(unsigned int base1, unsigned int len1, unsigned int base2, unsigned int len2);
float Vec3SqrDistance(float (*v1)[3], float (*v2)[3]);
float Vec3SqrDistance(const float v1[3], const float v2[3]);
template <typename T> inline void RotLeft(T& object, size_t bits)
{