本文整理汇总了C#中XMVector.Abs方法的典型用法代码示例。如果您正苦于以下问题:C# XMVector.Abs方法的具体用法?C# XMVector.Abs怎么用?C# XMVector.Abs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMVector
的用法示例。
在下文中一共展示了XMVector.Abs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FastIntersectAxisAlignedBoxPlane
public static void FastIntersectAxisAlignedBoxPlane(XMVector center, XMVector extents, XMVector plane, out XMVector outside, out XMVector inside)
{
// Compute the distance to the center of the box.
XMVector dist = XMVector4.Dot(center, plane);
// Project the axes of the box onto the normal of the plane. Half the
// length of the projection (sometime called the "radius") is equal to
// h(u) * abs(n dot b(u))) + h(v) * abs(n dot b(v)) + h(w) * abs(n dot b(w))
// where h(i) are extents of the box, n is the plane normal, and b(i) are the
// axes of the box. In this case b(i) = [(1,0,0), (0,1,0), (0,0,1)].
XMVector radius = XMVector3.Dot(extents, plane.Abs());
// Outside the plane?
outside = XMVector.Greater(dist, radius);
// Fully inside the plane?
inside = XMVector.Less(dist, -radius);
}