Find points inside a volume defined by a set of points in 3D space

526 Views Asked by At

Summary: Find points enclosed within other set of points in 3D space.

Details:

I have two set of points, A and B in same 3D space. About 8000 such A, B combos so lots of variety.

Both the points are already placed in 3D space following some predefined rules (distance of b should be atleast 2 away from a) and configs. They are static.

'B' is scattered in and around same space as A. It's basically water around object A.

If we can draw a surface around 'A' , it forms sort of irregular, rough polygons of various shapes and widths but within some max height in all cases.

There can be some space within A due to it's shape in which B can be present, not always though.

Question: How to find out which points from B are enclosed in A.

'A' may not form a continuous enclosed shape, reason:

Imagine it like, a crushed plastic water bottle (A) is in water tank (B), sliced by two parallel planes of X width. I need to figure which water(B) is within the bottle boundaries (A). If the bottle is sliced by two planes at any location, it gives three combos : a) the top slice, in which the cap is within the slice b) The mid, slice is cutting the bottle in center c) the bottom, in which the bottom is within the slice.

Case b will have two open sides, case a,c will have 1 open sides. In these cases the plane boundary should be used to get the enclosing location, this is why the width of these polygons (A) can be any but the height is maximum height of the slice.

I am using scipy, python so if there is any package which can help

Can't use convex hull as those straight lines can alter boundaries of irregular polygons.

eg of A, case b:

https://paste.debian.net/1221641/, this is a big ring like structure with lots of gap in between for b

https://paste.debian.net/1221666/ - this has really small gap which ma, may not hold a point.

case a,c:

https://paste.debian.net/1221667/ , small one, but you can get the idea

Thank You

1

There are 1 best solutions below

2
On

Instead of volumes, one can do cluster analysis. You do not actually obtain any approximation of the interface surface at all, only which cluster each point belongs to. A cluster is a spatially connected set of points belonging to the same original set. A pair of clusters is connected, if they belong to different original sets, but have a spatially connected pair of points.

The downside is that cluster analysis cannot really differentiate between "separated by empty space" and "separated by another cluster". That is, it cannot directly tell you if a cluster is completely enclosed by another cluster, or whether there is a hole in the outer cluster. That kind of examination is done separately.

However, it will tell you connected clusters – subsets of points from the original sets with the interface surface between them – and whether the original sets of points are continuous or spatially separated into separate subsets.

Unfortunately, this requires both point sets; either as separate point lists (files), or with a fourth component signifying the set. OP has only listed points from one set, and it is not clear whether both point sets are even available; and this analysis absolutely requires both sets to be feasible.