I have the coordinates for the centers and the radii of multiple spherical surfaces (hollow). These spheres may be of different radii, and some will overlap. Whenever they overlap, I want to eliminate the points along the surface of any sphere that is within another sphere or overlapped, so that I only get the "outside" view, so to speak.
How would I go about finding/eliminating these points of overlap? Is there an existing algorithm for finding these points?
Thanks in advance, and let me know if I can clarify the question better!
Edit 1:
The input will be a LAMMPS output file. The important section is below. The first column is the atom id, in order for atoms to be distinguishable. The next 3 are x,y,z coordinates. Radius is given by user input.
ATOMS_id x y z
________ ____ ____ ____
1 0 0 0
2 1.76 1.76 0
3 1.76 0 1.76
4 0 1.76 1.76
5 3.52 0 0
6 3.52 1.76 1.76
7 0 3.52 0
8 1.76 3.52 1.76
9 3.52 3.52 0
10 0 0 3.52
11 1.76 1.76 3.52
12 3.52 0 3.52
13 0 3.52 3.52
14 3.52 3.52 3.52
Using the above points and a radius of 1.6, this is the output of my current code (that only generates images).
The main problem is that my code (which uses the sphere(n)
and surf()
functions) draws all parts of the sphere, regardless of whether the points overlap. I want to essentially only get the coordinates that make up the outer surface of the above image, without the interior parts.
The easier case would be for just two spheres, as above.
I've managed to come up with some proof-of-concept algorithm for the 2-sphere case based on these two sources: src1, src2.
These are the results:
There are still a few errant points inside the joint volume, but I would argue that the situation is much better than at the beginning.
Note: This FEX submission may be of use to you.