Commit 08e0ec93 authored by Jaime Torres Amate's avatar Jaime Torres Amate
Browse files

fix a crash in box2d (that also crashes kolf)

with some data extracted from a kolf course, box2d calculates a
negative area, that is not possible in Real*Real vector space.

fixed using the abs area of each triangle.

Also filled a bug in box2d (I have had to use okteta to bypass their
captcha).

BUG: 258998
FIXED-IN: 4.10
REVIEW: 107739
parent 9bc093c0
...@@ -104,7 +104,7 @@ static b2Vec2 ComputeCentroid(const b2Vec2* vs, int32 count) ...@@ -104,7 +104,7 @@ static b2Vec2 ComputeCentroid(const b2Vec2* vs, int32 count)
qreal D = b2Cross(e1, e2); qreal D = b2Cross(e1, e2);
qreal triangleArea = 0.5f * D; qreal triangleArea = qAbs(0.5f * D);
area += triangleArea; area += triangleArea;
// Area weighted centroid // Area weighted centroid
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment