Let's say I have list of points P0, P1, P2, P3
with coordinates X,Y,Z
Then I have a list of points with coordinates X1, Y1, Z1
I had to find all points inside a certain radius around P0
: I did this using python scipy library using kdtree
and query_ball_point
function.
But now I'd like to find all points inside a cube. Points (P0
and P1
) are not centered in the rectangle.
(Z)height of the rectangle is Z+4.
(Y)The left side of P0
is +2 and right side of P0
is +1.
To get X we need to calculate the distance between P0
and P1
...
Any ideas?
I have good programming knowledge but my math and geometry skills are lacking.
all you need to do is check all distnace conditions for every point in relation to your rectangle - in all dimensions x,y,z.
Lets say you have center of rectangle with coordinates cx,cy,cz
and you know that distance from X side is dX, from Y side is dY and from Z side is dZ.
the coordinates of your socalled center is cx,cy,cz
you can make loop
NOTE:
This example is good for cube with center in the middle. Since your center is not really in the middle, I advice you to find the center and do the above example
If you cant calculate center of your cube, you cant solve this problem anyway, so you better find the center.