Page 1 of 1

Best way to check if a point is inside a convex hull shape?

Posted: Wed Oct 24, 2012 5:33 pm
by cgripeos
The reason I ask is because raycasts don't work if the begin and end point of the ray is inside a convex hull shape, so for convex shapes I tried to use the isInside() method and found out that it's not implemented for btConvexHullShape nor btConvexPointCloudShape.

Thanks in advance for any help.
cg

Re: Best way to check if a point is inside a convex hull sha

Posted: Wed Oct 24, 2012 9:59 pm
by Erwin Coumans
You can use the btCollisionWorld::contactPairTest.

Object 1 = convex hull
Object 2 = btSphereShape with zero radius

Alternatively, you can go low level (digg into the source code) and use btGjkPairDetector directly. See Demos\ConvexHullDistance\ConvexHullDistanceDemo.cpp.

Re: Best way to check if a point is inside a convex hull sha

Posted: Wed Oct 24, 2012 10:21 pm
by cgripeos
Ah! thank you, sir!

Re: Best way to check if a point is inside a convex hull sha

Posted: Mon Jun 24, 2013 1:45 am
by damanb
I was hoping that the isInside had been updated on the more recent versions but it doesn't seem to be. Did you end up getting your project working with checking if a point is inside the convex hull?

I am also in need of this for my research application. I am very new to bullet and don't quite see how to use the btGjkPairdetector. Do I only need to set a radius of the btSphereShape or can I also set a point for the center to be at?