Math/Plane: Fix construction from 3 points
This commit is contained in:
@@ -460,7 +460,7 @@ namespace Nz
|
||||
T farW = farH * ratio;
|
||||
|
||||
Vector3<T> f = Vector3<T>::Normalize(target - eye);
|
||||
Vector3<T> u(up.GetNormal());
|
||||
Vector3<T> u = Vector3<T>::Normalize(up);
|
||||
Vector3<T> s = Vector3<T>::Normalize(f.CrossProduct(u));
|
||||
u = s.CrossProduct(f);
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace Nz
|
||||
template<typename T>
|
||||
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);
|
||||
|
||||
@@ -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<typename T>
|
||||
constexpr T Plane<T>::SignedDistance(const Vector3<T>& point) const
|
||||
{
|
||||
return normal.DotProduct(point) + distance; // ax + by + cz + d = 0.
|
||||
return normal.DotProduct(point) + distance; // ax + by + cz + d = 0
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user