本文整理汇总了C#中BEPUutilities.BoundingBox.Intersects方法的典型用法代码示例。如果您正苦于以下问题:C# BoundingBox.Intersects方法的具体用法?C# BoundingBox.Intersects怎么用?C# BoundingBox.Intersects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BEPUutilities.BoundingBox
的用法示例。
在下文中一共展示了BoundingBox.Intersects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEntries
public void GetEntries(BoundingBox boundingShape, IList<BroadPhaseEntry> overlaps)
{
//Compute the min and max of the bounding box.
//Loop through the cells and select bounding boxes which overlap the x axis.
Int2 min, max;
Grid2DSortAndSweep.ComputeCell(ref boundingShape.Min, out min);
Grid2DSortAndSweep.ComputeCell(ref boundingShape.Max, out max);
for (int i = min.Y; i <= max.Y; i++)
{
for (int j = min.Z; j <= max.Z; j++)
{
//Grab the cell that we are currently in.
Int2 cellIndex;
cellIndex.Y = i;
cellIndex.Z = j;
GridCell2D cell;
if (owner.cellSet.TryGetCell(ref cellIndex, out cell))
{
//To fully accelerate this, the entries list would need to contain both min and max interval markers.
//Since it only contains the sorted min intervals, we can't just start at a point in the middle of the list.
//Consider some giant bounding box that spans the entire list.
for (int k = 0; k < cell.entries.Count
&& cell.entries.Elements[k].item.boundingBox.Min.X <= boundingShape.Max.X; k++) //TODO: Try additional x axis pruning? A bit of optimization potential due to overlap with AABB test.
{
bool intersects;
var item = cell.entries.Elements[k].item;
boundingShape.Intersects(ref item.boundingBox, out intersects);
if (intersects && !overlaps.Contains(item))
{
overlaps.Add(item);
}
}
}
}
}
}