How to render convex shape?
-
- Posts: 14
- Joined: Thu May 15, 2008 6:09 pm
How to render convex shape?
Hi, simple question, is there an easy way to render convex shape defined by list of points? I'm using btIDebugDraw from bullet, but shape is hard to recognise, i see only some strange lines and bounding box...
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: How to render convex shape?
One possible method is to generate every possible triangle. This is obviously a lot of triangles, though. For n convex hull points I believe it is n(n-1)(n-2)/3 triangles. Maybe there is some method for filtering down the triangles afterwards.
-
- Posts: 14
- Joined: Thu May 15, 2008 6:09 pm
Re: How to render convex shape?
yes, I thought about this already, but can bullet help me with it? I belive that creating triangle mesh from points is not easy task..
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: How to render convex shape?
It sounds like you have a bug or you're using bullet wrong. A screenshot and/or reproduction case would probably help.
-
- Posts: 14
- Joined: Thu May 15, 2008 6:09 pm
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: How to render convex shape?
The btShapeHull utility generates the triangles from a convex point cloud. The debug drawer should use this utility in the future.is there an easy way to render convex shape defined by list of points
See Bullet/Demos/ConvexDecompositionDemo for an example how to use the btShapeHull utility:
Code: Select all
btShapeHull* hull = new btShapeHull(tmpConvexShape);
btScalar margin = tmpConvexShape->getMargin();
hull->buildHull(margin);
printf("new numTriangles = %d\n", hull->numTriangles ());
printf("new numIndices = %d\n", hull->numIndices ());
printf("new numVertices = %d\n", hull->numVertices ());
Erwin
-
- Posts: 39
- Joined: Fri May 08, 2009 9:27 pm
Re: How to render convex shape?
Hi,
I did try to use the btShapeHull utility to draw my convex hull shapes, but it makes the whole drawing uber slow, and apart the speed problem, I still see the convex shape being drawn erratically as icek was mentioning.
Has anyone found a better way to draw convex hull shape in a better way?
Verbo
I did try to use the btShapeHull utility to draw my convex hull shapes, but it makes the whole drawing uber slow, and apart the speed problem, I still see the convex shape being drawn erratically as icek was mentioning.
Has anyone found a better way to draw convex hull shape in a better way?
Verbo