suejunghuh
Posts: 9 Joined: Wed Oct 02, 2013 7:08 pm
Post
by suejunghuh » Wed Oct 02, 2013 7:14 pm
In methods,
VoronoiBreakingDemo::voronoiConvexHullShatter
VoronoiBreakingDemo::voronoiBBShatter
j shoud start from i+1 not 1.
-----------
for (i=0; i < numpoints ;i++) {
curVoronoiPoint = points
;
btVector3 icp = quatRotate(bbiq, curVoronoiPoint - bbt);
rbb = icp - bbmax;
nrbb = bbmin - icp;
planes.resize(6);
planes[0] = bbvx; planes[0][3] = rbb.x();
planes[1] = bbvy; planes[1][3] = rbb.y();
planes[2] = bbvz; planes[2][3] = rbb.z();
planes[3] = -bbvx; planes[3][3] = nrbb.x();
planes[4] = -bbvy; planes[4][3] = nrbb.y();
planes[5] = -bbvz; planes[5][3] = nrbb.z();
maxDistance = SIMD_INFINITY;
sortedVoronoiPoints.heapSort(pointCmp());
for (j=i+1 ; j < numpoints; j++) { <<<====================== Here
Erwin Coumans
Site Admin
Posts: 4221 Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Post
by Erwin Coumans » Thu Oct 03, 2013 7:40 pm
Your 'fix' breaks the demo, have you tried it?
suejunghuh
Posts: 9 Joined: Wed Oct 02, 2013 7:08 pm
Post
by suejunghuh » Thu Oct 10, 2013 6:18 pm
Oh!
There should be only one fix in the method,
VoronoiBreakingDemo::voronoiConvexHullShatter
j shoud start from i+1 not 1.
Attached is the file with the comment FIX - UPDATE.
[The code has been updated with the most recent one.]
You do not have the required permissions to view the files attached to this post.
Last edited by suejunghuh on Mon Oct 21, 2013 7:30 am, edited 2 times in total.
Flix
Posts: 456 Joined: Tue Dec 25, 2007 1:06 pm
Post
by Flix » Fri Oct 11, 2013 10:18 am
Your "new fix" does not break the demo anymore, because in the demo VoronoiBreakingDemo::voronoiConvexHullShatter is never called.
However if I apply your proposed fix to a demo where voronoiConvexHullShatter is used, it still breaks the demo in a similiar way...
suejunghuh
Posts: 9 Joined: Wed Oct 02, 2013 7:08 pm
Post
by suejunghuh » Sun Oct 13, 2013 7:03 am
Sorry I was testing this in a different setting
where the convex was only axis-aligned when voronoiConvexHullShatter is called.
Now I have changed my code so it would work on the general setting exactly the same setting like the demo.
It should roughly run 2 times faster than the original demo, by storing the history.
By the way, I know the original code was just for the demo (kindly provided by Alain Ducharme),
so I know it wasn't meant to be as efficient as it could be in the first place.
Thanks.
Last edited by suejunghuh on Mon Oct 21, 2013 7:25 am, edited 1 time in total.
suejunghuh
Posts: 9 Joined: Wed Oct 02, 2013 7:08 pm
Post
by suejunghuh » Sun Oct 13, 2013 7:04 am
Also nor my code is as efficient as it could be...
suejunghuh
Posts: 9 Joined: Wed Oct 02, 2013 7:08 pm
Post
by suejunghuh » Sun Oct 13, 2013 8:15 am
By the way, I have added getVerticesInsidePlanes2.
Attached is the updated header.
You do not have the required permissions to view the files attached to this post.
suejunghuh
Posts: 9 Joined: Wed Oct 02, 2013 7:08 pm
Post
by suejunghuh » Sun Oct 13, 2013 3:48 pm
The code is updated to re-use the previously computed/found planes.
Note that now the iteration starts at i+1 at // UPDATE - FIX
Indeed!
Thanks.
Last edited by suejunghuh on Mon Oct 21, 2013 7:25 am, edited 1 time in total.
suejunghuh
Posts: 9 Joined: Wed Oct 02, 2013 7:08 pm
Post
by suejunghuh » Sun Oct 13, 2013 5:10 pm
By the way, the change is reflected only in voronoiConvexHullShatter not in voronoiBBShatter.
suejunghuh
Posts: 9 Joined: Wed Oct 02, 2013 7:08 pm
Post
by suejunghuh » Sat Oct 19, 2013 9:48 am
The plane computation was incorrect. Attached is the modified code.
In my rough benchmark, it was around 40% faster than the original.
You do not have the required permissions to view the files attached to this post.