checking a ray against all the objects in a cell
_KDTreeNode::Intersect()

at the beginning of time, we constructed 6 sorted lists (_sorted_lists[0-6]) of the objects, along each axis, in each direction. We take the major axis of the ray (Ray::Primary_Axis() and Direction(), both in JLLib/ray.C), which is the axis of greatest length, and use that sorted list. 


for each object in the sorted list
	if we've already got a hit, and this object's bbox doesn't overlap the hit object's bbox, then we're done; return the hit

	object->Intersect (ray);
	if we missed, continue
	if we hit, compare the intersection point to the best one we've got so far; if it's better, store it.
	
return our best hit or no hit


  case KDTreeNodeIntersect_Start:
  case KDTreeNodeIntersect_NewBest:
  case KDTreeNodeIntersect_Obj:
  case KDTreeNodeIntersect_End:
    return new DefaultVis (parent, ev);


enum EndIntersectWhy {GivenHitBetter, GotHit, RanOut};

class KDTreeIntersect_End_Entry {
public:
  EndIntersectWhy _why;
  Hit _hit;

  KDTreeIntersect_End_Entry (EndIntersectWhy why, Hit hit) : _hit (hit), _why (why) {}
};

class KDTreeNodeIntersect_Start_Entry {
public:
  _KDTreeNode *_node;
  int _paxis;
  float _maxloc;
  Hit _hit;
  KDTreeNodeIntersect_Start_Entry (_KDTreeNode *node, int paxis, float maxloc, const Hit &hit) : _node (node), _paxis (paxis), _maxloc (maxloc), _hit (hit) {}
};

enum NodeEndIntersectWhy {SortedListShortcut, AllObjsEnd};

class KDTreeNodeIntersect_NewBest_Entry {
public:
  Hit _hit;
  KDTreeNodeIntersect_NewBest_Entry (const Hit &hit) : _hit (hit) {}
};

class KDTreeNodeIntersect_Obj_Entry {
public:
  RayCastable *_obj;
  int _pastbbox;
  int _hit;
  KDTreeNodeIntersect_Obj_Entry (RayCastable *obj, int pastbbox, int hit) : _obj (obj), _pastbbox (pastbbox), _hit (hit) {}
};

class KDTreeNodeIntersect_End_Entry {
public:
  NodeEndIntersectWhy _why;
  KDTreeNodeIntersect_End_Entry (NodeEndIntersectWhy why) : _why (why) {}
};
