new constructor

This commit is contained in:
ikpil 2023-05-14 12:36:04 +09:00
parent 9f6f1a0b33
commit cc6fde19bb
2 changed files with 47 additions and 51 deletions

View File

@ -83,7 +83,6 @@ namespace DotRecast.Core
}
public static float Step(float threshold, float v)
{
return v < threshold ? 0.0f : 1.0f;
@ -127,39 +126,39 @@ namespace DotRecast.Core
/// @param[in] t The interpolation factor. [Limits: 0 <= value <= 1.0]
public static Vector3f VLerp(float[] verts, int v1, int v2, float t)
{
Vector3f dest = new Vector3f();
dest.x = verts[v1 + 0] + (verts[v2 + 0] - verts[v1 + 0]) * t;
dest.y = verts[v1 + 1] + (verts[v2 + 1] - verts[v1 + 1]) * t;
dest.z = verts[v1 + 2] + (verts[v2 + 2] - verts[v1 + 2]) * t;
return dest;
return new Vector3f(
verts[v1 + 0] + (verts[v2 + 0] - verts[v1 + 0]) * t,
verts[v1 + 1] + (verts[v2 + 1] - verts[v1 + 1]) * t,
verts[v1 + 2] + (verts[v2 + 2] - verts[v1 + 2]) * t
);
}
public static Vector3f VLerp(Vector3f v1, Vector3f v2, float t)
{
Vector3f dest = new Vector3f();
dest.x = v1.x + (v2.x - v1.x) * t;
dest.y = v1.y + (v2.y - v1.y) * t;
dest.z = v1.z + (v2.z - v1.z) * t;
return dest;
return new Vector3f(
v1.x + (v2.x - v1.x) * t,
v1.y + (v2.y - v1.y) * t,
v1.z + (v2.z - v1.z) * t
);
}
public static Vector3f VSub(Vector3f v1, Vector3f v2)
{
Vector3f dest = new Vector3f();
dest.x = v1.x - v2.x;
dest.y = v1.y - v2.y;
dest.z = v1.z - v2.z;
return dest;
return new Vector3f(
v1.x - v2.x,
v1.y - v2.y,
v1.z - v2.z
);
}
public static Vector3f VAdd(Vector3f v1, Vector3f v2)
{
Vector3f dest = new Vector3f();
dest.x = v1.x + v2.x;
dest.y = v1.y + v2.y;
dest.z = v1.z + v2.z;
return dest;
return new Vector3f(
v1.x + v2.x,
v1.y + v2.y,
v1.z + v2.z
);
}
public static void VSet(ref Vector3f @out, float a, float b, float c)
@ -219,7 +218,6 @@ namespace DotRecast.Core
}
/// Returns the distance between two points.
/// @param[in] v1 A point. [(x, y, z)]
/// @param[in] v2 A point. [(x, y, z)]
@ -233,7 +231,6 @@ namespace DotRecast.Core
}
/// Derives the square of the scalar length of the vector. (len * len)
/// @param[in] v The vector. [(x, y, z)]
/// @return The square of the scalar length of the vector.
@ -450,7 +447,6 @@ namespace DotRecast.Core
}
/// Determines if two axis-aligned bounding boxes overlap.
/// @param[in] amin Minimum bounds of box A. [(x, y, z)]
/// @param[in] amax Maximum bounds of box A. [(x, y, z)]
@ -477,7 +473,7 @@ namespace DotRecast.Core
public static bool OverlapBounds(float[] amin, float[] amax, float[] bmin, float[] bmax)
{
bool overlap = true;
overlap = (amin[0]> bmax[0] || amax[0] < bmin[0]) ? false : overlap;
overlap = (amin[0] > bmax[0] || amax[0] < bmin[0]) ? false : overlap;
overlap = (amin[1] > bmax[1] || amax[1] < bmin[1]) ? false : overlap;
overlap = (amin[2] > bmax[2] || amax[2] < bmin[2]) ? false : overlap;
return overlap;
@ -737,7 +733,6 @@ namespace DotRecast.Core
}
public static IntersectResult IntersectSegmentPoly2D(Vector3f p0, Vector3f p1, float[] verts, int nverts)
{
IntersectResult result = new IntersectResult();

View File

@ -126,5 +126,6 @@ namespace DotRecast.Core
{
return !left.Equals(right);
}
}
}