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
        /** 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);
                }
            }
        }
Esempio n. 2
0
		/** 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 );
				}
			}
		}