forked from mirror/DotRecast
refactor: move Dot2D function
This commit is contained in:
parent
bc7b02d8bb
commit
33fa18cd0e
|
@ -122,28 +122,6 @@ namespace DotRecast.Core.Numerics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// 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] v A vector [(x, y, z)]
|
|
||||||
/// @return The dot product on the xz-plane.
|
|
||||||
///
|
|
||||||
/// The vectors are projected onto the xz-plane, so the y-values are
|
|
||||||
/// ignored.
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public readonly float Dot2D(RcVec3f v)
|
|
||||||
{
|
|
||||||
return X * v.X + Z * v.Z;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public readonly float Dot2D(float[] v, int vi)
|
|
||||||
{
|
|
||||||
return X * v[vi] + Z * v[vi + 2];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
if (!(obj is RcVec3f))
|
if (!(obj is RcVec3f))
|
||||||
|
|
|
@ -34,5 +34,26 @@ namespace DotRecast.Core.Numerics
|
||||||
{
|
{
|
||||||
return v * scale;
|
return v * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 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] v A vector [(x, y, z)]
|
||||||
|
/// @return The dot product on the xz-plane.
|
||||||
|
///
|
||||||
|
/// The vectors are projected onto the xz-plane, so the y-values are
|
||||||
|
/// ignored.
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static float Dot2D(this RcVec3f @this, RcVec3f v)
|
||||||
|
{
|
||||||
|
return @this.X * v.X +
|
||||||
|
@this.Z * v.Z;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static float Dot2D(this RcVec3f @this, float[] v, int vi)
|
||||||
|
{
|
||||||
|
return @this.X * v[vi] +
|
||||||
|
@this.Z * v[vi + 2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue