<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/107739/">http://git.reviewboard.kde.org/r/107739/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On December 16th, 2012, 2:58 p.m., <b>Albert Astals Cid</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Waht do you mean R*R and C*C ?
Also this is quite interesting because box2d is used in lots of projects and looking at their upstream code (don't ask me why we have it embedded) it seems the function is still unchanged</pre>
</blockquote>
<p>On December 16th, 2012, 9:19 p.m., <b>Jaime Torres Amate</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">R*R is the mathematical infinite plane where all the (real,real) vectors live. In that space, all the mathematical things with dimension between 1 and 2 (including fractals) have area >=0.
C*C is the mathematical infinite plane where all the (complex,complex) vectors live. This space has other properties not found in R*R, including objects with area <0.
This is a strange bug because very few people suffer it, and also because the vectors follow clock hands (siguen el sentido de las manecillas del reloj), as required by box2d. But with the data in the bug report, the area becomes negative, and then the crash.
Also, I remember to have run it under valgrind with no sign of memory overwriten, and with gcc -ftrapv without any overflow or underflow.
Without the patch, I get
kolf: /g/kdegit/kdegames/kolf/external/Box2D/Collision/Shapes/b2PolygonShape.cpp:116: b2Vec2 ComputeCentroid(const b2Vec2*, int32): La declaraciĆ³n `area > b2_floatValues<sizeof(qreal)>::epsilon()' no se cumple.
</pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Ok, makes sense, do you think you could contact the box2d people and tell them the following code asserts?
int main(int argc, char **argv)
{
b2Vec2 vv[8];
vv[0].Set(0.200000,0);
vv[1].Set(0.141421,-0.159099);
vv[2].Set(0.000000,-0.225000);
vv[3].Set(-0.141421,-0.159099);
vv[4].Set(-0.200000,-0.000000);
vv[5].Set(-0.141421,0.159099);
vv[6].Set(-0.000000,0.225000);
vv[7].Set(0.141421,0.159099);
b2Vec2 v = ComputeCentroid(vv, 8);
}
It's ok if you don't but it'd be better if we can keep our difference with upstream box2d as small as possible (to be honest i don't like the fact we have our own embedded version)</pre>
<br />
<p>- Albert</p>
<br />
<p>On December 15th, 2012, 6:09 p.m., Jaime Torres Amate wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for KDE Games.</div>
<div>By Jaime Torres Amate.</div>
<p style="color: grey;"><i>Updated Dec. 15, 2012, 6:09 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Avoid a crash starting kolf.
The crash comes when the calculated area is <0, something impossible in R*R (only in C*C).
The patch makes the area always >=0.
The patch is similar to what I proposed then, but I forgot how to use reviewboard for svn.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">before, the crash (yes, I still suffer it).
after, kolf runs.</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="http://bugs.kde.org/show_bug.cgi?id=258998">258998</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>external/Box2D/Collision/Shapes/b2PolygonShape.cpp <span style="color: grey">(c96583b)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/107739/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>