Ok, I think I’ve determined how to get the Xmin,Xmax,Ymin,Ymax of the world coordinate system for grid generation. There are three conditions.

- The xy plane does not pass thru the viewing frustum.
- The xy plane is co-planar with one of the clipping planes of the frustum
- The xy plane passes thru the viewing frustum which means the xy plane intersects at least three of the intersections between two clipping planes. I hope that makes sense.

The method:

- Construct 12 vectors representing the intersections of 2 clipping planes. For example one vector might represent the intersection of the far and top planes.
- Determine which vectors are coplanar with the model coordinate system xy plane. If enough vectors are coplanar use those vectors to set up the grid XY values and go to step 4.
- Determine if and where the 12 vectors intersect the model coordinate system xy plane. Use the intersection points to set up grid XY values.
- draw grid.

Questions:

- To get the normal of the model coordinate system I just need to multiply the vector (0,0,1) times the model transform matrix, right? Should I then normalize the result?
- To determine if a vector is coplanar with the xy plane I need to check that the dot product of the xy plane normal and the vector in question is zero, right?
- What calculation do I perform to determine if one of the 12 vectors intersects the model xy plane and where?

What do you think? Will this work?