• Advertisement
Sign in to follow this  

Polygon outward facing normals

This topic is 1093 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

Hi guys,

 

A general question about building polygons in 2D.

 

Given a set of vertices which compose a polygon we know that the lines between the vertices can have two facing normals.

 

Algorithmically, for a random polygon, how does one ensure that all normals are facing outwards, that is, away from the center of mass (given a point mass system).

 

Thanks,

 

Mike

Share this post


Link to post
Share on other sites
Advertisement
By enforcing a particular winding order. For example, if you decide to define all polygons in clockwise order (when facing) them the normal of each segment is the left hand perpendicular (y, -x).

Otherwise not sure there is a well defined answer but I could be wrong. I may also mean -y, x above, need a bit of paper to be sure :)

Share this post


Link to post
Share on other sites

Thanks for the help guys, that makes sense.

 

I need to ask you a question Randy about your physics engine if you don't mind. I have been stuyding your tutorials for a couple of months now with Ian Millington's Game Physics Engine Develeopment.

 

You seperate your entities using what you call slop, however, Ian uses a more intuitive seperation along the normal in proportion to the inverse masses (which you also implement)

 

What are the advantages/disadvantages of seperatiing Millington's way vs your slop?

 

Thanks,

 

Mike

Share this post


Link to post
Share on other sites

That's probably a good post for another topic, but that's ok we can talk about it here. The slop is just a small factor to allow objects to penetrate each other ever so slightly. This helps a little bit to reduce jitter. If we try to drive separation to exactly 0 when we solve overlap overshoot is more likely to occur. It's like a small margin of error where we consider the separation "good enough" and don't try to resolve the overlap.

 

Ian Millington is most surely doing something nearly identical, but perhaps presented in a different manner. He also continues to try to create what he calls "resting contacts". In my opinion these are just hacky work arounds to help the naive impulse solvers in Impulse Engine and Millington's Cyclone Engine with jitter.

 

I should note that while Millington's and my Impulse Engine are good places for a first draft of a physics engine, if you'd like to continue studying more professional technique's Erin Catto's public resources are industry standard. Just a note! smile.png

 

Hope that helps!

Edited by Randy Gaul

Share this post


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

  • Advertisement