Use larger epsilon in Vector IsNormalized checks

This commit is contained in:
2024-08-04 20:15:12 +03:00
parent d6e99071aa
commit 387e8d1dd9
13 changed files with 13 additions and 13 deletions

View File

@@ -179,7 +179,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathd.IsOne(X * X + Y * Y);
public bool IsNormalized => Mathd.Abs((X * X + Y * Y) - 1.0f) < 1e-4f;
/// <summary>
/// Gets a value indicting whether this vector is zero

View File

@@ -234,7 +234,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathd.IsOne(X * X + Y * Y + Z * Z);
public bool IsNormalized => Mathd.Abs((X * X + Y * Y + Z * Z) - 1.0f) < 1e-4f;
/// <summary>
/// Gets the normalized vector. Returned vector has length equal 1.

View File

@@ -220,7 +220,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathd.IsOne(X * X + Y * Y + Z * Z + W * W);
public bool IsNormalized => Mathd.Abs((X * X + Y * Y + Z * Z + W * W) - 1.0f) < 1e-4f;
/// <summary>
/// Gets a value indicting whether this vector is zero

View File

@@ -184,7 +184,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathf.IsOne(X * X + Y * Y);
public bool IsNormalized => Mathf.Abs((X * X + Y * Y) - 1.0f) < 1e-4f;
/// <summary>
/// Gets a value indicting whether this vector is zero

View File

@@ -228,7 +228,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathf.IsOne(X * X + Y * Y + Z * Z);
public bool IsNormalized => Mathf.Abs((X * X + Y * Y + Z * Z) - 1.0f) < 1e-4f;
/// <summary>
/// Gets the normalized vector. Returned vector has length equal 1.

View File

@@ -202,7 +202,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathf.IsOne(X * X + Y * Y + Z * Z + W * W);
public bool IsNormalized => Mathf.Abs((X * X + Y * Y + Z * Z + W * W) - 1.0f) < 1e-4f;
/// <summary>
/// Gets a value indicting whether this vector is zero

View File

@@ -163,7 +163,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathf.IsOne(X * X + Y * Y + Z * Z + W * W);
public bool IsNormalized => Mathf.Abs((X * X + Y * Y + Z * Z + W * W) - 1.0f) < 1e-4f;
/// <summary>
/// Gets the euler angle (pitch, yaw, roll) in degrees.

View File

@@ -107,7 +107,7 @@ public:
/// </summary>
bool IsNormalized() const
{
return Math::IsOne(X * X + Y * Y + Z * Z + W * W);
return Math::Abs((X * X + Y * Y + Z * Z + W * W) - 1.0f) < 1e-4f;
}
/// <summary>

View File

@@ -207,7 +207,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathr.IsOne(X * X + Y * Y);
public bool IsNormalized => Mathr.Abs((X * X + Y * Y) - 1.0f) < 1e-4f;
/// <summary>
/// Gets a value indicting whether this vector is zero

View File

@@ -105,7 +105,7 @@ public:
// Gets a value indicting whether this instance is normalized.
bool IsNormalized() const
{
return Math::IsOne(X * X + Y * Y);
return Math::Abs((X * X + Y * Y) - 1.0f) < 1e-4f;
}
// Gets a value indicting whether this vector is zero.

View File

@@ -256,7 +256,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathr.IsOne(X * X + Y * Y + Z * Z);
public bool IsNormalized => Mathr.Abs((X * X + Y * Y + Z * Z) - 1.0f) < 1e-4f;
/// <summary>
/// Gets the normalized vector. Returned vector has length equal 1.

View File

@@ -136,7 +136,7 @@ public:
// Gets a value indicting whether this instance is normalized.
bool IsNormalized() const
{
return Math::IsOne(X * X + Y * Y + Z * Z);
return Math::Abs((X * X + Y * Y + Z * Z) - 1.0f) < 1e-4f;
}
// Gets a value indicting whether this vector is zero.

View File

@@ -258,7 +258,7 @@ namespace FlaxEngine
/// <summary>
/// Gets a value indicting whether this instance is normalized.
/// </summary>
public bool IsNormalized => Mathr.IsOne(X * X + Y * Y + Z * Z + W * W);
public bool IsNormalized => Mathr.Abs((X * X + Y * Y + Z * Z + W * W) - 1.0f) < 1e-4f;
/// <summary>
/// Gets a value indicting whether this vector is zero