Jump to content
  • Advertisement
Sign in to follow this  
kbundy023

Math: Get the plane from the polgyon?

This topic is 3611 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Quote:
Original post by kbundy023

Hello all

What is the formula for getting the plane from the polygon used for BSP Tree?

Thank you
Typically you compute the supporting plane for a polygon by:

1. Taking the cross product of two non-colinear edges of the polygon and normalizing the result to yield the plane normal (if it matters which direction the normal points, you'll need to be consistent in your choice of edges).

2. Taking the dot product of the plane normal and any vertex of the polygon to yield the plane distance (depending on which convention you're using for your plane representation, you may need to negate this value).

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
Quote:
Original post by kbundy023

Hello all

What is the formula for getting the plane from the polygon used for BSP Tree?

Thank you
Typically you compute the supporting plane for a polygon by:

1. Taking the cross product of two non-colinear edges of the polygon and normalizing the result to yield the plane normal (if it matters which direction the normal points, you'll need to be consistent in your choice of edges).

2. Taking the dot product of the plane normal and any vertex of the polygon to yield the plane distance (depending on which convention you're using for your plane representation, you may need to negate this value).


How about if i want to find the intersection from the edge to the plane to split the polygon?

Share this post


Link to post
Share on other sites
Quote:
How about if i want to find the intersection from the edge to the plane to split the polygon?
That's a different (and more complicated) problem. Try doing a search for 'Sutherland-Hodgman clipping'.

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
Quote:
How about if i want to find the intersection from the edge to the plane to split the polygon?
That's a different (and more complicated) problem. Try doing a search for 'Sutherland-Hodgman clipping'.


I find the intersection of a plane with a line.

line equation : lp = a + (b - a)t

-> n . p = 0
-> n . (lp - q)
-> n . ((a + (b-a)t - q) = 0
-> n . (a + (b-a)t) - n . q = 0
-> n . a + n . (b-a) . t - n . q = 0
-> n . (b-a) . t = n . q - n . a
-> t = (n . (q - a)) / n . ( b - a )

I know the n, a, and b. But I do i find q.

Share this post


Link to post
Share on other sites
Quote:
Original post by kbundy023
Quote:
Original post by jyk
Quote:
How about if i want to find the intersection from the edge to the plane to split the polygon?
That's a different (and more complicated) problem. Try doing a search for 'Sutherland-Hodgman clipping'.


I find the intersection of a plane with a line.

line equation : lp = a + (b - a)t

-> n . p = 0
-> n . (lp - q)
-> n . ((a + (b-a)t - q) = 0
-> n . (a + (b-a)t) - n . q = 0
-> n . a + n . (b-a) . t - n . q = 0
-> n . (b-a) . t = n . q - n . a
-> t = (n . (q - a)) / n . ( b - a )

I know the n, a, and b. But I do i find q.


Would q be any vertices on the plane?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!