internal override void Refit(MeshBoundingBoxTreeData data)
 {
     data.GetBoundingBox(LeafIndex, out BoundingBox);
     //Having an ever-so-slight margin allows the hierarchy use a volume metric even for degenerate shapes (consider a flat tessellated plane).
     BoundingBox.Max.X += LeafMargin;
     BoundingBox.Max.Y += LeafMargin;
     BoundingBox.Max.Z += LeafMargin;
     BoundingBox.Min.X -= LeafMargin;
     BoundingBox.Min.Y -= LeafMargin;
     BoundingBox.Min.Z -= LeafMargin;
 }
 /// <summary>
 /// Constructs a new tree.
 /// </summary>
 /// <param name="data">Data to use to construct the tree.</param>
 public MeshBoundingBoxTree(MeshBoundingBoxTreeData data)
 {
     Data = data;
 }
 internal abstract void Refit(MeshBoundingBoxTreeData data);
 internal override void Refit(MeshBoundingBoxTreeData data)
 {
     ChildA.Refit(data);
     ChildB.Refit(data);
     BoundingBox.CreateMerged(ref ChildA.BoundingBox, ref ChildB.BoundingBox, out BoundingBox);
 }
Example #5
0
 ///<summary>
 /// Constructs a new triangle mesh.
 ///</summary>
 ///<param name="data">Data to use to construct the mesh.</param>
 public TriangleMesh(MeshBoundingBoxTreeData data)
 {
     this.data = data;
     tree      = new MeshBoundingBoxTree(data);
 }