0

I have the equations of two spheres in MATLAB, like

(x-x0)^2+(y-y0)^2+(z-z0)^2=R0^2
(x-x1)^2+(y-y1)^2+(z-z1)^2=R1^2

They have an intersecting part (I find a similar picture which could explain my meaning on the web like below)

enter image description here

Now I would like to only draw the spatial intersecting volume of these two spheres (like the 3D part between the curved faces with red lines in the sample image above) Maybe I could use the command 'surface' in MATLAB to draw out those two curved faces which make up the intersecting volume? I do not know how to do it....

Moreover, I also would like to draw these two spheres after erasing out those intersecting parts

That is, my goal: drawing out the intersecting and non-intersecting part of these two spheres individually.

Could anyone help me?

Thank you!

Junyan Liu
  • 87
  • 9

1 Answers1

-1

The answer is given in great detail at Wolfram. In brief, rather than copypaste all the equations:

1) calculate the circle of intersection of the two sphere's surfaces.

2) determine the location of that circle on each sphere.

3) Calculate the volume of each sphere's spherical cap for that circle and add the two volumes to get the "lens."

I am recommending this be moved to Math.SE because it is a math problem, and coding it in Matlab is trivial.

Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73