Draws the intersecting volume of two spheres in MATLAB?

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)

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!


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.

链接地址: http://www.djcxy.com/p/67300.html

上一篇: 在Matlab中查找pcolor中的轮廓/边缘

下一篇: 在MATLAB中绘制两个球体的相交体积?