diff --git a/include/Nazara/Math/Frustum.inl b/include/Nazara/Math/Frustum.inl index 99e6519cf..6bddf1fe4 100644 --- a/include/Nazara/Math/Frustum.inl +++ b/include/Nazara/Math/Frustum.inl @@ -460,7 +460,7 @@ namespace Nz T farW = farH * ratio; Vector3 f = Vector3::Normalize(target - eye); - Vector3 u(up.GetNormal()); + Vector3 u = Vector3::Normalize(up); Vector3 s = Vector3::Normalize(f.CrossProduct(u)); u = s.CrossProduct(f); diff --git a/include/Nazara/Math/Plane.hpp b/include/Nazara/Math/Plane.hpp index 13ca6a311..e804dbc82 100644 --- a/include/Nazara/Math/Plane.hpp +++ b/include/Nazara/Math/Plane.hpp @@ -17,6 +17,8 @@ namespace Nz template class Plane { + // Note: this class follows the ax + by + cz + d = 0 equation, which means d is the distance from origin + public: constexpr Plane() = default; constexpr Plane(T normalX, T normalY, T normalZ, T Distance); diff --git a/include/Nazara/Math/Plane.inl b/include/Nazara/Math/Plane.inl index e3455820c..bb971899a 100644 --- a/include/Nazara/Math/Plane.inl +++ b/include/Nazara/Math/Plane.inl @@ -88,7 +88,7 @@ namespace Nz normal = edge1.CrossProduct(edge2); normal.Normalize(); - distance = normal.DotProduct(point3); + distance = -normal.DotProduct(point3); } /*! @@ -139,7 +139,7 @@ namespace Nz template constexpr T Plane::SignedDistance(const Vector3& point) const { - return normal.DotProduct(point) + distance; // ax + by + cz + d = 0. + return normal.DotProduct(point) + distance; // ax + by + cz + d = 0 } /*!