forked from bit/DotRecastNetSim
refactor: preparing for switching build with System.Numerics.Vector3
This commit is contained in:
parent
5c2dd6b757
commit
0368afea23
|
@ -95,20 +95,6 @@ namespace DotRecast.Core.Numerics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public void Set(float a, float b, float c)
|
|
||||||
{
|
|
||||||
X = a;
|
|
||||||
Y = b;
|
|
||||||
Z = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public void Set(float[] @in)
|
|
||||||
{
|
|
||||||
Set(@in, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Set(float[] @in, int i)
|
public void Set(float[] @in, int i)
|
||||||
{
|
{
|
||||||
|
@ -432,24 +418,6 @@ namespace DotRecast.Core.Numerics
|
||||||
return dx * dx + dy * dy + dz * dz;
|
return dx * dx + dy * dy + dz * dz;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static float DistSqr(float[] v, int i, int j)
|
|
||||||
{
|
|
||||||
float dx = v[i] - v[j];
|
|
||||||
float dy = v[i + 1] - v[j + 1];
|
|
||||||
float dz = v[i + 2] - v[j + 2];
|
|
||||||
return dx * dx + dy * dy + dz * dz;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static float DistSqr(float[] v1, float[] v2)
|
|
||||||
{
|
|
||||||
float dx = v2[0] - v1[0];
|
|
||||||
float dy = v2[1] - v1[1];
|
|
||||||
float dz = v2[2] - v1[2];
|
|
||||||
return dx * dx + dy * dy + dz * dz;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Derives the distance between the specified points on the xz-plane.
|
/// Derives the distance between the specified points on the xz-plane.
|
||||||
/// @param[in] v1 A point. [(x, y, z)]
|
/// @param[in] v1 A point. [(x, y, z)]
|
||||||
/// @param[in] v2 A point. [(x, y, z)]
|
/// @param[in] v2 A point. [(x, y, z)]
|
||||||
|
@ -457,14 +425,6 @@ namespace DotRecast.Core.Numerics
|
||||||
///
|
///
|
||||||
/// The vectors are projected onto the xz-plane, so the y-values are
|
/// The vectors are projected onto the xz-plane, so the y-values are
|
||||||
/// ignored.
|
/// ignored.
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static float Dist2D(float[] v1, float[] v2)
|
|
||||||
{
|
|
||||||
float dx = v2[0] - v1[0];
|
|
||||||
float dz = v2[2] - v1[2];
|
|
||||||
return (float)Math.Sqrt(dx * dx + dz * dz);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static float Dist2D(RcVec3f v1, RcVec3f v2)
|
public static float Dist2D(RcVec3f v1, RcVec3f v2)
|
||||||
{
|
{
|
||||||
|
@ -473,15 +433,6 @@ namespace DotRecast.Core.Numerics
|
||||||
return (float)Math.Sqrt(dx * dx + dz * dz);
|
return (float)Math.Sqrt(dx * dx + dz * dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static float Dist2DSqr(float[] v1, float[] v2)
|
|
||||||
{
|
|
||||||
float dx = v2[0] - v1[0];
|
|
||||||
float dz = v2[2] - v1[2];
|
|
||||||
return dx * dx + dz * dz;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static float Dist2DSqr(RcVec3f v1, RcVec3f v2)
|
public static float Dist2DSqr(RcVec3f v1, RcVec3f v2)
|
||||||
{
|
{
|
||||||
|
@ -605,14 +556,6 @@ namespace DotRecast.Core.Numerics
|
||||||
dest[2] = v1[0] * v2[1] - v1[1] * v2[0];
|
dest[2] = v1[0] * v2[1] - v1[1] * v2[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static void Cross(float[] dest, RcVec3f v1, RcVec3f v2)
|
|
||||||
{
|
|
||||||
dest[0] = v1.Y * v2.Z - v1.Z * v2.Y;
|
|
||||||
dest[1] = v1.Z * v2.X - v1.X * v2.Z;
|
|
||||||
dest[2] = v1.X * v2.Y - v1.Y * v2.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Cross(ref RcVec3f dest, RcVec3f v1, RcVec3f v2)
|
public static void Cross(ref RcVec3f dest, RcVec3f v1, RcVec3f v2)
|
||||||
{
|
{
|
||||||
|
@ -621,7 +564,6 @@ namespace DotRecast.Core.Numerics
|
||||||
dest.Z = v1.X * v2.Y - v1.Y * v2.X;
|
dest.Z = v1.X * v2.Y - v1.Y * v2.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Normalize(ref RcVec3f v)
|
public static void Normalize(ref RcVec3f v)
|
||||||
{
|
{
|
||||||
|
|
|
@ -161,7 +161,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
public DtCrowd(DtCrowdConfig config, DtNavMesh nav, Func<int, IDtQueryFilter> queryFilterFactory)
|
public DtCrowd(DtCrowdConfig config, DtNavMesh nav, Func<int, IDtQueryFilter> queryFilterFactory)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_ext.Set(config.maxAgentRadius * 2.0f, config.maxAgentRadius * 1.5f, config.maxAgentRadius * 2.0f);
|
_ext = new RcVec3f(config.maxAgentRadius * 2.0f, config.maxAgentRadius * 1.5f, config.maxAgentRadius * 2.0f);
|
||||||
|
|
||||||
_obstacleQuery = new DtObstacleAvoidanceQuery(config.maxObstacleAvoidanceCircles, config.maxObstacleAvoidanceSegments);
|
_obstacleQuery = new DtObstacleAvoidanceQuery(config.maxObstacleAvoidanceCircles, config.maxObstacleAvoidanceSegments);
|
||||||
|
|
||||||
|
@ -1240,11 +1240,11 @@ namespace DotRecast.Detour.Crowd
|
||||||
// Agents on top of each other, try to choose diverging separation directions.
|
// Agents on top of each other, try to choose diverging separation directions.
|
||||||
if (idx0 > idx1)
|
if (idx0 > idx1)
|
||||||
{
|
{
|
||||||
diff.Set(-ag.dvel.Z, 0, ag.dvel.X);
|
diff = new RcVec3f(-ag.dvel.Z, 0, ag.dvel.X);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
diff.Set(ag.dvel.Z, 0, -ag.dvel.X);
|
diff = new RcVec3f(ag.dvel.Z, 0, -ag.dvel.X);
|
||||||
}
|
}
|
||||||
|
|
||||||
pen = 0.01f;
|
pen = 0.01f;
|
||||||
|
|
|
@ -412,7 +412,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
else if (n == 0)
|
else if (n == 0)
|
||||||
{
|
{
|
||||||
// The first polyref is bad, use current safe values.
|
// The first polyref is bad, use current safe values.
|
||||||
m_pos.Set(safePos);
|
m_pos = new RcVec3f(safePos);
|
||||||
m_path.Clear();
|
m_path.Clear();
|
||||||
m_path.Add(safeRef);
|
m_path.Add(safeRef);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@ namespace DotRecast.Detour.Extras.Jumplink
|
||||||
this.trajectory = trajectory;
|
this.trajectory = trajectory;
|
||||||
ax = RcVec3f.Subtract(edge.sq, edge.sp);
|
ax = RcVec3f.Subtract(edge.sq, edge.sp);
|
||||||
ax.Normalize();
|
ax.Normalize();
|
||||||
az.Set(ax.Z, 0, -ax.X);
|
az = new RcVec3f(ax.Z, 0, -ax.X);
|
||||||
az.Normalize();
|
az.Normalize();
|
||||||
ay.Set(0, 1, 0);
|
ay = new RcVec3f(0, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue