Axiom.SceneManagers.Octree.OctreeNode.IsInBox C# (CSharp) Method

IsInBox() public method

Determines if the center of this node is within the given box.
public IsInBox ( Axiom.MathLib.AxisAlignedBox box ) : bool
box Axiom.MathLib.AxisAlignedBox
return bool
		public bool IsInBox( AxisAlignedBox box )
		{
			Vector3 center = worldAABB.Maximum.MidPoint( worldAABB.Minimum );
			Vector3 min = box.Minimum;
			Vector3 max = box.Maximum;

			return ( max > center && min < center );
		}

Usage Example

        /** Checks the given OctreeNode, and determines if it needs to be moved
        * to a different octant.
        */
        public void UpdateOctreeNode(OctreeNode node) {
            AxisAlignedBox box = node.WorldAABB;
        
            if(box.IsNull) {
                return;
            }

            if(node.Octant == null) {
                //if outside the octree, force into the root node.
                if(!node.IsInBox(octree.Box)) {
                    octree.AddNode(node);
                }
                else {
                    AddOctreeNode(node, octree);
                    return;
                }
            }

            if(!node.IsInBox(node.Octant.Box)) {
                RemoveOctreeNode(node);

                //if outside the octree, force into the root node.
                if(!node.IsInBox(octree.Box)) {
                    octree.AddNode(node);
                }
                else {
                    AddOctreeNode(node,octree);
                }
            }
        }
All Usage Examples Of Axiom.SceneManagers.Octree.OctreeNode::IsInBox