Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Scaling plane to view all points

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2008
    Posts
    1

    Scaling plane to view all points

    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

  2. #2
    Intern Contributor
    Join Date
    Jul 2004
    Location
    Toronto
    Posts
    97

    Re: Scaling plane to view all points

    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/csc41.../pipeline.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •