Is there a way to calculate if a 3D point is between a list of 3D points?

Here I drew a pyramid.
Circled in blue there is a point.
With Python I try to detect if a the blue circled 3D point is inside the list of 3D points (the list of 3D points, the corners of the pyramid, act as a boundary).

I just want to learn if this could work. Theoretically it could work by allowing a maximum distance of the blue circled 3D points to the list of 3D points. But, I cannot figure it out.
It tried some ways but I cannot find the right way to do it.

Do you might know something about ‘allowing a maximum distance to each point’ like ‘letting everything of the list of 3D points pretending being a boundary?’

Hi,
i’m afraid this won’t work. Using distance, you can’t never be sure if you are inside or outside your figure.

If you build panels on your figure, you can orientate the panels (normal points outside). Then you can project your point on nearest panel. Having the second point you can check if the vector from this two points has the same direction as the panel normal.

My real script is only based on numbers and list of numbers representing coordinates of points.

With python I am searching for mathematical solutions to gain time. It takes hours (about exaggerated) to calculate everything with grasshopper geometries. With more than 2563 points I build everything in coordinates (list of numbers).

Is there really not a way to do things with points?It is like ‘when the testPn is positioned at that place compared to that point,’ by angle ‘there is a maximum allowed distance’ (to all boundary points).

Ah! Maybe I got it.
Or maybe not.
A boundary point measured to every other boundary points forms the maximum distance within a certain angle.

Checking the distance to the testPn comparing it to the maximum distance by angle to a boundary point, it can detect if the point is inside or outside.

This is so hard…

I cannot wrap my brain around it yet (is that the correct English expression?).

Of course there is. If you know which points form the corners of the pyramid, then you can calculate a plane from three points, say from common corner a, and a-b & a-c forms two legs, from which you can take the cross-product and from that create a plane suing the crossproduct as the plane Normal. The test if the point is always “outside” the planes for all planes.

Edit: Like so (red line is the “crossproduct” vector of ab & ac):

Well, I think in this case it will be a “false economy”. Even if you have thousands of points a convex hull is very quickly calculated, that is the advantage of that algorithm. Probably much faster than having to check ALL of your points every time. The test for point inclusion in the convex hull might be slower, but still it sounds like you are trying to make this thing more complicated than it is.

For example, I have a convex hull made over 10,000 points in a triangle, that takes 15ms here in GH. If I overlay a random set of 1000 points and then check to see which are in and which are out of the hull, it takes 14ms…

If the test point is “outside” (on the Normal’s side) of all the planes, then the point is not inside the pyramid. (Edit: Just make sure the planes are oriented “outwards” by ordering the legs in the right order to the CrossProduct calculation).

The testPn within a angle-range within a length. 2D it is possible I think. But 3D? That is difficult for me.

Closer to that angle, than the max distance is ‘that,’ closer to another angle than the max is ‘that.’ Taking the average of those things and I have the average length 2D and 3D theoretically.

They use the “plane” strategy I suggested above. They say

“You now just check if a point P is on the other side of the plane. The normal of each plane is pointing away from the center of the tetrahedron. So you just have to test against 4 planes.”