forked from mirror/DotRecast
move RcMath.VCross -> Vector3f.Cross
This commit is contained in:
parent
0cdf8c67b4
commit
5928befe25
|
@ -33,7 +33,7 @@ namespace DotRecast.Core
|
|||
|
||||
// Compute triangle normal. Can be precalculated or cached if
|
||||
// intersecting multiple segments against the same triangle
|
||||
Vector3f norm = VCross(ab, ac);
|
||||
Vector3f norm = Vector3f.Cross(ab, ac);
|
||||
|
||||
// Compute denominator d. If d <= 0, segment is parallel to or points
|
||||
// away from triangle, so exit early
|
||||
|
@ -59,7 +59,7 @@ namespace DotRecast.Core
|
|||
}
|
||||
|
||||
// Compute barycentric coordinate components and test if within bounds
|
||||
Vector3f e = VCross(qp, ap);
|
||||
Vector3f e = Vector3f.Cross(qp, ap);
|
||||
v = VDot(ac, e);
|
||||
if (v < 0.0f || v > d)
|
||||
{
|
||||
|
|
|
@ -52,14 +52,6 @@ namespace DotRecast.Core
|
|||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
public static Vector3f VCross(Vector3f v1, Vector3f v2)
|
||||
{
|
||||
Vector3f dest = new Vector3f();
|
||||
dest.x = v1.y * v2.z - v1.z * v2.y;
|
||||
dest.y = v1.z * v2.x - v1.x * v2.z;
|
||||
dest.z = v1.x * v2.y - v1.y * v2.x;
|
||||
return dest;
|
||||
}
|
||||
|
||||
public static float VDot(Vector3f v1, Vector3f v2)
|
||||
{
|
||||
|
@ -336,13 +328,6 @@ namespace DotRecast.Core
|
|||
return VEqual(p0, p1, EQUAL_THRESHOLD);
|
||||
}
|
||||
|
||||
|
||||
public static bool VEqual(float[] p0, float[] p1, float thresholdSqr)
|
||||
{
|
||||
float d = VDistSqr(p0, p1);
|
||||
return d < thresholdSqr;
|
||||
}
|
||||
|
||||
public static bool VEqual(Vector3f p0, Vector3f p1, float thresholdSqr)
|
||||
{
|
||||
float d = VDistSqr(p0, p1);
|
||||
|
|
|
@ -162,5 +162,15 @@ namespace DotRecast.Core
|
|||
{
|
||||
return left.Subtract(right);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Vector3f Cross(Vector3f v1, Vector3f v2)
|
||||
{
|
||||
return new Vector3f(
|
||||
(v1.y * v2.z) - (v1.z * v2.y),
|
||||
(v1.z * v2.x) - (v1.x * v2.z),
|
||||
(v1.x * v2.y) - (v1.y * v2.x)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -248,7 +248,7 @@ public class DynamicUpdateTool : Tool
|
|||
Vector3f baseUp = Vector3f.Of(0, 1, 0);
|
||||
Vector3f forward = Vector3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble()));
|
||||
VNormalize(ref forward);
|
||||
Vector3f side = VCross(forward, baseUp);
|
||||
Vector3f side = Vector3f.Cross(forward, baseUp);
|
||||
BoxCollider @base = new BoxCollider(baseCenter, Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(baseUp, forward, baseExtent),
|
||||
SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, dynaMesh.config.walkableClimb);
|
||||
var roofUp = Vector3f.Zero;
|
||||
|
|
Loading…
Reference in New Issue