FIxed objects not being added to any oct-tree partition because they
FIxed objects not being added to any oct-tree partition because they
lie exactly on the boundary.

--- a/ObjectList.cpp
+++ b/ObjectList.cpp
@@ -36,6 +36,7 @@
 
 IntersectionInformation ObjectList::intersection(Ray ray) const
 {
+  //std::cout << "ObjectList::intersection(Ray ray) const" << std::endl;
   return _octTree->intersection(ray);
 }
 

--- a/OctTreeNode.cpp
+++ b/OctTreeNode.cpp
@@ -4,6 +4,9 @@
 
 OctTreeNode::OctTreeNode(std::vector<Object*> objects,Vector minPoint,Vector maxPoint,bool forceLeaf)
 {
+  //static int x=0;
+  //x++;
+  //std::cout << "x=" << x << std::endl;
   if(objects.size()>10 && !forceLeaf)
     {
       for(std::vector<Object*>::const_iterator iter=objects.begin();
@@ -66,37 +69,37 @@
 	  iter!=objects.end();
 	  iter++)
 	{
-	  if((*iter)->maxPoint().x()>avg.x())
-	    {
-	      if((*iter)->maxPoint().y()>avg.y())
-		{
-		  if((*iter)->maxPoint().z()>avg.z())
+	  if((*iter)->maxPoint().x()>=avg.x())
+	    {
+	      if((*iter)->maxPoint().y()>=avg.y())
+		{
+		  if((*iter)->maxPoint().z()>=avg.z())
 		    partitions[0].push_back(*iter);
-		  if((*iter)->minPoint().z()<avg.z())
+		  if((*iter)->minPoint().z()<=avg.z())
 		    partitions[1].push_back(*iter);
 		}
-	      if((*iter)->minPoint().y()<avg.y())
-		{
-		  if((*iter)->maxPoint().z()>avg.z())
+	      if((*iter)->minPoint().y()<=avg.y())
+		{
+		  if((*iter)->maxPoint().z()>=avg.z())
 		    partitions[2].push_back(*iter);
-		  if((*iter)->minPoint().z()<avg.z())
+		  if((*iter)->minPoint().z()<=avg.z())
 		    partitions[3].push_back(*iter);
 		}
 	    }
-	  if((*iter)->minPoint().x()<avg.x())
-	    {
-	      if((*iter)->maxPoint().y()>avg.y())
-		{
-		  if((*iter)->maxPoint().z()>avg.z())
+	  if((*iter)->minPoint().x()<=avg.x())
+	    {
+	      if((*iter)->maxPoint().y()>=avg.y())
+		{
+		  if((*iter)->maxPoint().z()>=avg.z())
 		    partitions[4].push_back(*iter);
-		  if((*iter)->minPoint().z()<avg.z())
+		  if((*iter)->minPoint().z()<=avg.z())
 		    partitions[5].push_back(*iter);
 		}
-	      if((*iter)->minPoint().y()<avg.y())
-		{
-		  if((*iter)->maxPoint().z()>avg.z())
+	      if((*iter)->minPoint().y()<=avg.y())
+		{
+		  if((*iter)->maxPoint().z()>=avg.z())
 		    partitions[6].push_back(*iter);
-		  if((*iter)->minPoint().z()<avg.z())
+		  if((*iter)->minPoint().z()<=avg.z())
 		    partitions[7].push_back(*iter);
 		}
 	    }
@@ -113,6 +116,7 @@
     }
   else
     _objects=objects;
+  //x--;
 }
 
 OctTreeNode::~OctTreeNode()
@@ -144,6 +148,7 @@
 IntersectionInformation OctTreeNode::leafIntersection(Ray ray) const
 {
   //std::cout << "OctTreeNode::leafIntersection(Ray ray), this=" << this << std::endl;
+
   // Find the object that this ray intersects with
   double smallestDistance=-1;
   Object *closestObject=0;
@@ -156,7 +161,7 @@
       if(currentIntersection.intersects())
 	{
 	  double distanceToIntersection=ray.distanceToPoint(currentIntersection.xyz());
-	  //printf("distanceToIntersection\t=\t%f\n",distanceToIntersection);
+	  //std::cout << "distanceToIntersection=" << distanceToIntersection << std::endl;
 	  if(closestObject==0 || distanceToIntersection<smallestDistance)
 	    {
 	      closestObject=(*iter);
@@ -176,7 +181,7 @@
   //std::cout << "OctTreeNode::nodeIntersection(Ray ray), this=" << this << std::endl;
   IntersectionInformation bbtest=_boundingBox.intersection(ray);
   if(!bbtest.intersects()) return IntersectionInformation();
-  
+
   // Find the object that this ray intersects with
   double smallestDistance=-1;
   IntersectionInformation closestIntersection;