czaloj / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

Create a utility for btConvexHullShape to embed the collision margin. #156

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

By default, the btConvexHullShape collision margin grows the object (unlike 
btBoxShape, btSphereShape).

There is an automatic way of shifting the vertices in a way that moves the 
margin inside:

1) convert the vertices into plane equations
2) shift the plane equations inwards along the plane normal, using the 
margin
3) convert the plane equations back into vertices
4) create a new btConvexHullShape using those vertices

Provide a utility that does this.

Original issue reported on code.google.com by erwin.coumans on 30 Nov 2008 at 4:39

GoogleCodeExporter commented 9 years ago
Is there already someone working on this? I could try do implement this utility.

Original comment by ol...@arcor.de on 6 Feb 2009 at 8:41

GoogleCodeExporter commented 9 years ago
We currently have a small utility function for this, although it's still under 
testing.

Original comment by mr.lundm...@gmail.com on 13 Aug 2009 at 9:03

GoogleCodeExporter commented 9 years ago
I uploaded a patch with a completely new convex hull algorithm: 
http://code.google.com/p/bullet/issues/detail?
id=275 . This also has the option to shrink the hull as described above.

Original comment by ol...@arcor.de on 15 Sep 2009 at 7:42

GoogleCodeExporter commented 9 years ago

I haven't looked at this issue for a while, but there was already a code 
snippet in 
Bullet ConvexDecompositionDemo that can do the job:

std::vector<btVector3> planeEquations;
btGeometryUtil::getPlaneEquationsFromVertices(vertices,planeEquations);
std::vector<btVector3> shiftedPlaneEquations;
for (int p=0;p<planeEquations.size();p++)
{
    btVector3 plane = planeEquations[p];
    plane[3] += 5*collisionMargin;
    shiftedPlaneEquations.push_back(plane);
}
std::vector<btVector3> shiftedVertices;
btGeometryUtil::getVerticesFromPlaneEquations(shiftedPlaneEquations,shiftedVerti
ces);
btConvexHullShape* convexShape = new 
btConvexHullShape(&(shiftedVertices[0].getX()),shiftedVertices.size());

Simon (Lundmark), if you want to share your utility, please attach it. Also, 
Ole, I 
hope you have time to implement that convex patch in a new file (not changing 
btConvexHullShape)

Thanks!

Original comment by erwin.coumans on 23 Jan 2010 at 12:16

GoogleCodeExporter commented 9 years ago
The snippet in ConvexDecompositionDemo does the job, but it's brute force. That 
may be OK for some 
applications, but I needed a fast algorithm, therefore my patch.

I haven't forgotten to create a new patch and make some benchmarks, but I am 
still quite busy with other things, 
sorry.

Original comment by ol...@arcor.de on 29 Jan 2010 at 6:55

GoogleCodeExporter commented 9 years ago
this issue should have closed long time ago, the convex hull has been in Bullet 
for ages now.
See 
https://code.google.com/p/bullet/source/browse/trunk/src/LinearMath/btConvexHull
Computer.cpp

http://code.google.com/p/bullet/issues/detail?id=275
Thanks for your contribution.

Original comment by erwin.coumans on 9 Sep 2012 at 9:54