Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack corruption if three or more points are collinear in b2PolygonShape. #326

Closed
GoogleCodeExporter opened this issue Apr 1, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create a polygon fixture using the following vertices:
(0,0)
(10,10)
(5,5)
(3,3)
(any set where 3 or more vertices are collinear)

2. These vertices are collinear and are expected to be incorrect.
3. "b2PolygonShape::Set()" will fail because it uses the gift-wrapping 
algorithm as described here 
(http://en.wikipedia.org/wiki/Gift_wrapping_algorithm) which assumes no three 
points are collinear.  This results in a stack corruption if this is the case.

What is the expected output? What do you see instead?
The polygon to be set as degenerate.

What version of the product are you using? On what operating system?
v2.3.0

Please provide any additional information below.

It would be extremely valuable to be able to explicitly check an arbitrary set 
of points for validity using Box2Ds code i.e. "b2PolygonShape::Validate (const 
b2Vec2* vertices, int32 count)".  This could not only include degenerate checks 
but other checks such as valid area which is done when calculating the centroid 
of said polygon (area > b2_epsilon).

Original issue reported on code.google.com by melv....@gmail.com on 13 Jan 2014 at 9:10

@GoogleCodeExporter
Copy link
Author

Completed: At revision: 304  

Fix for issue 326. Added test to check for collinear points in the convex hull 
code.

Original comment by erinca...@gmail.com on 5 Apr 2014 at 6:35

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant