Smaller equalExact (probably should just get rid of this tbh)

Fix for ClosestPointOnLine
This commit is contained in:
Jonathan 2021-10-24 14:20:24 -04:00
parent bfc854efcb
commit 3456f62a90
2 changed files with 5 additions and 5 deletions

View File

@ -459,6 +459,10 @@ qvec3f ClosestPointOnLine(const qvec3f &v, const qvec3f &w, const qvec3f &p)
const qvec3f vp = p - v;
const qvec3f vw_norm = qv::normalize(w - v);
if (qv::emptyExact(vw_norm)) {
return p;
}
const float vp_scalarproj = qv::dot(vp, vw_norm);
const qvec3f p_projected_on_vw = v + (vw_norm * vp_scalarproj);

View File

@ -470,11 +470,7 @@ template<size_t N, class T>
template<size_t N, class T>
[[nodiscard]] constexpr bool equalExact(const qvec<T, N> &v1, const qvec<T, N> &v2)
{
for (size_t i = 0; i < N; i++) {
if (v1[i] != v2[i])
return false;
}
return true;
return v1 == v2;
}
template<size_t N, class T>