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

Post Reply
cgripeos
Posts: 20
Joined: Mon Sep 24, 2007 5:45 am

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

Post 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
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

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

Post 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.
cgripeos
Posts: 20
Joined: Mon Sep 24, 2007 5:45 am

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

Post by cgripeos »

Ah! thank you, sir!
damanb
Posts: 3
Joined: Mon Jun 24, 2013 1:32 am

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

Post 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?
Post Reply