本文整理汇总了C#中BoundingBox.SupportMapping方法的典型用法代码示例。如果您正苦于以下问题:C# BoundingBox.SupportMapping方法的具体用法?C# BoundingBox.SupportMapping怎么用?C# BoundingBox.SupportMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingBox
的用法示例。
在下文中一共展示了BoundingBox.SupportMapping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GjkBatteryTest
public void GjkBatteryTest()
{
Gjk gjk = new Gjk();
const int iterations = 10000;
//Point to point test
for (int i = 0; i < iterations; ++i)
{
gjk.Reset();
Vector3 point1 = Utilities.GenerateVector3();
Vector3 point2 = Utilities.GenerateVector3();
float expected = Vector3.Distance(point1, point2);
float actual = gjk.GetMinimumDistance(v =>
{
return point1 - point2;
});
Utilities.AreEqual(expected, actual);
}
//Sphere to sphere test
for (int i = 0; i < iterations; ++i)
{
gjk.Reset();
BoundingSphere shape1 = new BoundingSphere(Utilities.GenerateVector3(), Utilities.GenerateFloat());
BoundingSphere shape2 = new BoundingSphere(Utilities.GenerateVector3(), Utilities.GenerateFloat());
float expected = Collision.DistanceSphereSphere(ref shape1, ref shape2);
if (Collision.SphereIntersectsSphere(ref shape1, ref shape2))
{
i--;
continue;
}
float actual = gjk.GetMinimumDistance(v =>
{
Vector3 a = shape1.SupportMapping(v);
Vector3 b = shape2.SupportMapping(-v);
return a - b;
});
Utilities.AreEqual(expected, actual);
}
//Box to box test
for (int i = 0; i < iterations; ++i)
{
gjk.Reset();
BoundingBox shape1 = new BoundingBox(Utilities.GenerateVector3(), Utilities.GenerateVector3());
BoundingBox shape2 = new BoundingBox(Utilities.GenerateVector3(), Utilities.GenerateVector3());
float expected = Collision.DistanceBoxBox(ref shape1, ref shape2);
if (Collision.BoxIntersectsBox(ref shape1, ref shape2))
{
i--;
continue;
}
float actual = gjk.GetMinimumDistance(v =>
{
Vector3 a = shape1.SupportMapping(v);
Vector3 b = shape2.SupportMapping(-v);
return a - b;
});
Utilities.AreEqual(expected, actual);
}
}