本文整理汇总了C#中AABB.MaximumExtent方法的典型用法代码示例。如果您正苦于以下问题:C# AABB.MaximumExtent方法的具体用法?C# AABB.MaximumExtent怎么用?C# AABB.MaximumExtent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB
的用法示例。
在下文中一共展示了AABB.MaximumExtent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildSubTree
private Node BuildSubTree(List<Triangle> primitives, int start, int end)
{
if (start - end == 0)
return null;
AABB bound = primitives.GetRange(start, end - start).Select(prim => prim.WorldBound(sceneVertices)).Aggregate((b1, b2) => b1.Union(b2));
var node = new Node() { Bound = bound, Primitives = new List<TriangleDataInfo>()};
bvhNodesCount++;
if ((end - start) <= PrimitivesInNode)
{
var firstOffset = sortedPrims.Count;
for (var i = start; i < end; ++i)
{
var primNum = i;
sortedPrims.Add(triangles[primNum]);
}
node.PrimitiveIndexStart = firstOffset;
node.Primitives = primitives.GetRange(start, end - start);
return node;
}
var centroidBounds = new AABB();
for (var i = start; i < end; ++i)
centroidBounds = centroidBounds.Union(primitives[i].WorldBound(sceneVertices).Center);
int dim = centroidBounds.MaximumExtent();
if ((MathLab.SmallEnough(centroidBounds.Min[dim], centroidBounds.Max[dim])))
{
var firstOffset = start;
for (int i = start, ii = 0; i < end; ++i, ii++)
{
var primNum = i;
sortedPrims.Add(triangles[primNum]);
}
node.PrimitiveIndexStart = firstOffset;
node.Primitives = primitives.GetRange(start, end - start);
return node;
}
var mid = (start + end) / 2;
node.Left = this.BuildSubTree(primitives, start, mid);
node.Right = this.BuildSubTree(primitives, mid+1, end);
return node;
}