forked from mirror/DotRecast
Removed RcVecUtils.Scale()
This commit is contained in:
parent
0f20db44bb
commit
b18845a749
|
@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Removed RcVecUtils.Dot()
|
- Removed RcVecUtils.Dot()
|
||||||
|
- Removed RcVecUtils.Scale()
|
||||||
|
|
||||||
### Special Thanks
|
### Special Thanks
|
||||||
- [@Doprez](https://github.com/Doprez)
|
- [@Doprez](https://github.com/Doprez)
|
||||||
|
|
|
@ -42,12 +42,6 @@ namespace DotRecast.Core.Numerics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static RcVec3f Scale(this RcVec3f v, float scale)
|
|
||||||
{
|
|
||||||
return v * scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Derives the dot product of two vectors on the xz-plane. (@p u . @p v)
|
/// Derives the dot product of two vectors on the xz-plane. (@p u . @p v)
|
||||||
/// @param[in] u A vector [(x, y, z)]
|
/// @param[in] u A vector [(x, y, z)]
|
||||||
/// @param[in] v A vector [(x, y, z)]
|
/// @param[in] v A vector [(x, y, z)]
|
||||||
|
|
|
@ -1063,7 +1063,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
float speedScale = ag.GetDistanceToGoal(slowDownRadius) / slowDownRadius;
|
float speedScale = ag.GetDistanceToGoal(slowDownRadius) / slowDownRadius;
|
||||||
|
|
||||||
ag.desiredSpeed = ag.option.maxSpeed;
|
ag.desiredSpeed = ag.option.maxSpeed;
|
||||||
dvel = dvel.Scale(ag.desiredSpeed * speedScale);
|
dvel = dvel * (ag.desiredSpeed * speedScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Separation
|
// Separation
|
||||||
|
@ -1110,7 +1110,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
float desiredSqr = RcMath.Sqr(ag.desiredSpeed);
|
float desiredSqr = RcMath.Sqr(ag.desiredSpeed);
|
||||||
if (speedSqr > desiredSqr)
|
if (speedSqr > desiredSqr)
|
||||||
{
|
{
|
||||||
dvel = dvel.Scale(desiredSqr / speedSqr);
|
dvel = dvel * (desiredSqr / speedSqr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1268,7 +1268,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
if (w > 0.0001f)
|
if (w > 0.0001f)
|
||||||
{
|
{
|
||||||
float iw = 1.0f / w;
|
float iw = 1.0f / w;
|
||||||
ag.disp = ag.disp.Scale(iw);
|
ag.disp = ag.disp * iw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
RcVec3f dv = RcVec3f.Subtract(nvel, vel);
|
RcVec3f dv = RcVec3f.Subtract(nvel, vel);
|
||||||
float ds = dv.Length();
|
float ds = dv.Length();
|
||||||
if (ds > maxDelta)
|
if (ds > maxDelta)
|
||||||
dv = dv.Scale(maxDelta / ds);
|
dv = dv * (maxDelta / ds);
|
||||||
vel = RcVec3f.Add(vel, dv);
|
vel = RcVec3f.Add(vel, dv);
|
||||||
|
|
||||||
// Integrate
|
// Integrate
|
||||||
|
@ -150,7 +150,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
float len0 = dir0.Length();
|
float len0 = dir0.Length();
|
||||||
float len1 = dir1.Length();
|
float len1 = dir1.Length();
|
||||||
if (len1 > 0.001f)
|
if (len1 > 0.001f)
|
||||||
dir1 = dir1.Scale(1.0f / len1);
|
dir1 = dir1 * (1.0f / len1);
|
||||||
|
|
||||||
dir.X = dir0.X - dir1.X * len0 * 0.5f;
|
dir.X = dir0.X - dir1.X * len0 * 0.5f;
|
||||||
dir.Y = 0;
|
dir.Y = 0;
|
||||||
|
|
|
@ -236,7 +236,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
DtObstacleCircle cir = m_circles[i];
|
DtObstacleCircle cir = m_circles[i];
|
||||||
|
|
||||||
// RVO
|
// RVO
|
||||||
RcVec3f vab = vcand.Scale(2);
|
RcVec3f vab = vcand * 2;
|
||||||
vab = RcVec3f.Subtract(vab, vel);
|
vab = RcVec3f.Subtract(vab, vel);
|
||||||
vab = RcVec3f.Subtract(vab, cir.vel);
|
vab = RcVec3f.Subtract(vab, cir.vel);
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ namespace DotRecast.Recast.Toolset.Tools
|
||||||
RcVec3f vel = RcVec3f.Subtract(tgt, pos);
|
RcVec3f vel = RcVec3f.Subtract(tgt, pos);
|
||||||
vel.Y = 0.0f;
|
vel.Y = 0.0f;
|
||||||
vel = RcVec3f.Normalize(vel);
|
vel = RcVec3f.Normalize(vel);
|
||||||
return vel.Scale(speed);
|
return vel * speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long GetCrowdUpdateTime()
|
public long GetCrowdUpdateTime()
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class AbstractCrowdTest
|
||||||
RcVec3f vel = RcVec3f.Subtract(tgt, pos);
|
RcVec3f vel = RcVec3f.Subtract(tgt, pos);
|
||||||
vel.Y = 0.0f;
|
vel.Y = 0.0f;
|
||||||
vel = RcVec3f.Normalize(vel);
|
vel = RcVec3f.Normalize(vel);
|
||||||
vel = vel.Scale(speed);
|
vel = vel * speed;
|
||||||
return vel;
|
return vel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue