Box Constraints

I have a hundred or more points and i need the camera to see them all.

I assume I need a way to find out the constraints of several points in space and then use the front face as the screen for the camera, ie...

struct typBox
double top;
double right;
double front;
double height;
double width;
double depth;

#typedef struct typBox glBox

glBox getContraints()
double xMax = point[0].x, xMin = point[0].x;
double yMax = point[0].y, yMin = point[0].y;
double zMax = point[0].z, zMin = point[0].z;
for(int i = 1; i < NUM_OF_POINTS; i++)
if( xMax < point[i].x ) xMax = point[i].x;
if( xMin > point[i].x ) xMin = point[i].x;
if( yMax < point[i].y ) yMax = point[i].y;
if( yMin > point[i].y ) yMin = point[i].y;
if( zMax < point[i].z ) zMax = point[i].z;
if( zMin > point[i].z ) zMin = point[i].z;
glBox b; = yMax;
b.right = xMax;
b.front = zMax;
b.height = yMax - yMin;
b.width = xMax - xMin;
b.depth = zMax - zMin;

return b;

But you get the idea...

What i need, however, it to specify 2 vectors, up and forward.

(this is not a very good description but here goes)
The box returned will have 4 edges parallel with forward 4 edges parallel with up and 4 edges perpendicular to the plane (up, forward).

I hope you understand.

This changes the defenition of a box and the simple ...

if( xMax < point[i].x )

... much more complicated.

I'm using OpenGL and i need a fast method of doing this. Can anyone suggest something?




What does God need with a starship?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!