Results 1 to 2 of 2

Thread: Clipping planes

  1. #1
    Member Contributor
    Join Date
    Jul 2001
    Posts
    59

    Clipping planes

    I'm working on a CAD package. One of the features in the app is the ability to define a clipping plane to "slice" a model to allow the user to view to the internal structure. The interface renders this clipping plane with a translucent quad so that the user knows the location of the clipping plane. The user can then use a slider control to move the clipping plane through the model. Everything works great until I received the request to allow the user define a custom vector for the clipping plane as opposed to the XY Plane, XZ Plane, or YZ plane that I've already implemented.

    The actual clipping of the model is easy. I'm running into difficulty drawing the quad representing the clipping plane. I know the bounding box of the model, and I know the vector of the plane. How do I determine the four corners of the quad. Has someone out there done something similar to this that can help?

    Thanks
    Pat

  2. #2
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: Clipping planes

    Yes, I've done something similar.
    My brief was to not only clip the geometry against the plane, but also to accumulate all the intersection points of all the triangles that intersect the plane and draw them as connected lines! This meant that I basically had to do the triangle clipping manually.
    Once you've got all the intersection points, you just transform them onto an axis aligned plane (using the inverse transform of the clipping plane) and do a simple test on every intersection point to find the extremeties - then use that information (min + max) to define a quad on that axis aligned plane - then just transform the points of this quad by the original planes transform to get a nice 2d box that encloses all the clipped geometry.
    Phew! It was a fiddly thing to do, but its done now.
    Best of luck.
    Knackered

Similar Threads

  1. clipping planes
    By bloto in forum OpenGL: GLSL
    Replies: 8
    Last Post: 07-21-2004, 10:03 AM
  2. Clipping planes with Cg
    By rviney in forum OpenGL: GLSL
    Replies: 6
    Last Post: 03-02-2004, 11:00 PM
  3. Clipping planes with Cg
    By rviney in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 01-13-2004, 10:28 PM
  4. Replies: 1
    Last Post: 09-02-2003, 01:45 PM
  5. Clipping planes
    By KlaHyMan in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 02-17-2000, 10:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean