Having trouble with btGeometryUtil::isPointInsidePlanes

Post Reply
Massif
Posts: 2
Joined: Wed Apr 25, 2018 1:43 am

Having trouble with btGeometryUtil::isPointInsidePlanes

Post by Massif »

I'm in the process of parsing a BSP file to create btConvexHullShape objects for each brush. I've seen a few examples of how to do this on Github and they all use the getVerticesFromPlaneEquations function. This function in turn uses isPointInsidePlanes. The problem I'm having is that isPointInsidePlanes returns false for every potentialVertex, leaving me with an empty verticesOut array.

I'm looking at the code for isPointInsidePlanes, and it seems like it is checking the vertex against ALL planes in the brush which I find confusing.

For example if the brush is a simple rectangular prism, you wouldn't expect the point that results from the intersection of 3 planes to be inside all 6 planes, right? Shouldn't it only be checked against the 3 planes that intersected to locate it?

Now this file hasn't changed in 9 years, so either I'm doing something very wrong or nobody uses this function. I'm going to assume I'm wrong for the time being.


TL;DR: Why does isPointInsidePlanes check the point against every plane equation and not just the 3 that intersect to create it? Should I not even be using the getVerticesFromPlaneEquations function and instead be using something else?
Massif
Posts: 2
Joined: Wed Apr 25, 2018 1:43 am

Re: Having trouble with btGeometryUtil::isPointInsidePlanes

Post by Massif »

It turns out I had a fundamental misunderstanding of the purpose of the "isPointInsidePlanes" function. It is not checking whether the point lies on every plane. It is checking whether the point is behind every plane (since the normals of the planes point outwards) which ensures that the shape is convex.
Post Reply