Core/Maps: Fixed map min height calculation
This commit is contained in:
@@ -207,6 +207,19 @@ namespace Framework.GameMath
|
||||
{
|
||||
return Vector3.DotProduct(p, this.Normal) - this.Constant;
|
||||
}
|
||||
|
||||
public void getEquation(ref Vector3 n, out float d)
|
||||
{
|
||||
double _d;
|
||||
getEquation(ref n, out _d);
|
||||
d = (float)_d;
|
||||
}
|
||||
|
||||
void getEquation(ref Vector3 n, out double d)
|
||||
{
|
||||
n = _normal;
|
||||
d = -_const;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
@@ -192,6 +192,24 @@ namespace Framework.GameMath
|
||||
|
||||
#endregion
|
||||
|
||||
public Vector3 intersection(Plane plane)
|
||||
{
|
||||
float d;
|
||||
Vector3 normal = plane.Normal;
|
||||
plane.getEquation(ref normal, out d);
|
||||
float rate = Direction.dot(normal);
|
||||
|
||||
if (rate >= 0.0f)
|
||||
{
|
||||
return Vector3.Inf;
|
||||
}
|
||||
else
|
||||
{
|
||||
float t = -(d + Origin.dot(normal)) / rate;
|
||||
return Origin + Direction * t;
|
||||
}
|
||||
}
|
||||
|
||||
public float intersectionTime(AxisAlignedBox box)
|
||||
{
|
||||
Vector3 dummy = Vector3.Zero;
|
||||
|
||||
@@ -91,6 +91,8 @@ namespace Framework.GameMath
|
||||
public static readonly Vector3 Zero = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
public static readonly Vector3 One = new Vector3(1.0f, 1.0f, 1.0f);
|
||||
|
||||
public static readonly Vector3 Inf = new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point X-Axis vector.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user