Point In Breps weird behavior

I’ve been make a simple cs script to create a simple brep, when I trying to test a point is inside thease breps, some point ouside the brep has incorrect result.
Here is werid part, I baked these brep in to rhino document, and set it back to gh, and the results is changed to correct result.
img_v2_983a69c2-cbf9-4e53-9c58-d1cf978206dg
What could go wrong, they are literally the same brep.
Here is the gh file, and all my brep is create by this method Brep.CreateBooleanUnion(new[] { part1, part2, part3, part4 }, 1e-3);, it’s quite simple, I create each part separately and put them together by Union operation, them make some transformations.

unnamed1.gh (39.1 KB)

I tried it, it seems like a bug.
But if you turned the breps into meshes, it will show correctly.

It is likely that the point-is-inside test is done based on the (render)mesh of the Brep. That mesh is only created when you preview the component in grasshopper, or when you bake it to the rhino document.
The solution, as outlined above is to do the tests on a mesh you create for the brep in grasshopper. And I agree, that this is a bug.

@menno @Quan_Li thanks guys. So I can use Mesh.IsPointInside instead of Brep.IsPointInside, but it’s not a proper way for me, I can’t create mesh for each time brep needs test point inside, this process will slow down the entire progrom. Is there a way to set(or trigger) RenderMesh for brep when I just created the brep to cache this mesh for performance reason?