View Full Version : Scaling plane to view all points

kamillo

03-19-2008, 12:35 PM

Hi All,

I'd like to view all points I get, in my plane, but some of them have to big coordinates so I should scale it, but I don't know how to check if point after projection will be in plane...

Is there any method to scale plane that every point will be visible? Can you give me some advice?

thanks,

kamillo

Budric

03-19-2008, 02:47 PM

Here's a suggestion. You could compute the bounding box for all your points (because applying this to all the points isn't efficient). Then transform the bounding box into Viewing coordinate system.

If you're doing orthographic projection then you can easily calculate the left,right,top,bottom clipping planes by taking maximum/minimum x,y values of all the points you transformed.

If you're doing perspective projection you'll have to calculate the maximum/minimum x,y coordinates again and calculate the required viewing angle. You'll also have to calculate the minimum/maximum z values to get the near/far clipping planes correctly.

To transform into the Viewing coordinate system use

double modelView[16];

glGetDoublev(GL_MODELVIEW_MATRIX,modelView);

Then you'll have to write code to apply the transform to the points.

Here's a quick illustration of viewing coordinate system:

http://www.dgp.toronto.edu/~ah/csc418/fall_2001/notes/pipeline.html

Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.