@@ -29,6 +29,17 @@ String Plane::ToString() const
|
||||
return String::Format(TEXT("{}"), *this);
|
||||
}
|
||||
|
||||
void Plane::Normalize()
|
||||
{
|
||||
const float length = Normal.Length();
|
||||
if (!Math::IsZero(length))
|
||||
{
|
||||
const float rcp = 1.0f / length;
|
||||
Normal *= rcp;
|
||||
D *= rcp;
|
||||
}
|
||||
}
|
||||
|
||||
void Plane::Constlection(Matrix& result) const
|
||||
{
|
||||
const float x = Normal.X;
|
||||
|
||||
@@ -214,12 +214,15 @@ namespace FlaxEngine
|
||||
/// </summary>
|
||||
public void Normalize()
|
||||
{
|
||||
float magnitude = 1.0f / (float)Math.Sqrt(Normal.X * Normal.X + Normal.Y * Normal.Y + Normal.Z * Normal.Z);
|
||||
|
||||
Normal.X *= magnitude;
|
||||
Normal.Y *= magnitude;
|
||||
Normal.Z *= magnitude;
|
||||
D *= magnitude;
|
||||
float length = (float)Math.Sqrt(Normal.X * Normal.X + Normal.Y * Normal.Y + Normal.Z * Normal.Z);
|
||||
if (!Mathf.IsZero(length))
|
||||
{
|
||||
float rcp = 1.0f / length;
|
||||
Normal.X *= rcp;
|
||||
Normal.Y *= rcp;
|
||||
Normal.Z *= rcp;
|
||||
D *= rcp;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -97,14 +97,9 @@ public:
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Changes the coefficients of the normal vector of the plane to make it of unit length
|
||||
/// Changes the coefficients of the normal vector of the plane to make it of unit length.
|
||||
/// </summary>
|
||||
void Normalize()
|
||||
{
|
||||
const float magnitude = Normal.InvLength();
|
||||
Normal *= magnitude;
|
||||
D *= magnitude;
|
||||
}
|
||||
void Normalize();
|
||||
|
||||
void Negate()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user