Show intersection of two spheres

16 次查看(过去 30 天)
ercan duzgun
ercan duzgun 2021-1-6
编辑: Adam Danz 2021-1-6
How can I show the intersections of two spheres on MATLAB plot?
My code is this:
close all;clear all;clc;
pA1=[-2.9,-0.9,0]';
pA2=[-1.2,3.0,0]';
pB1=[1.3,-2.3,0]';
pB2=[-1.2,-3.7,0]';
pC1=[2.5,4.1,0]';
pC2=[3.2,1.0,0]';
patch([pA1(1),pA2(1),pC1(1),pC2(1),pB1(1),pB2(1)],[pA1(2),pA2(2),pC1(2),pC2(2),pB1(2),pB2(2)],0)
grid on; axis equal;hold on;
text(pA1(1),pA1(2),'A1');text(pA2(1),pA2(2),'A2')
text(pB1(1),pB1(2),'B1');text(pB2(1),pB2(2),'B2')
text(pC1(1),pC1(2),'C1');text(pC2(1),pC2(2),'C2')
L1=5.0;L2=4.5;L3=5.0;L4=5.5;L5=5.5;L6=5.7;
%kure ciziyor
[x y z] = sphere(128);x=L1*x;y=L1*y;z=L1*z;
h = surfl(x+pA1(1), y+pA1(2), z+pA1(3));
set(h, 'FaceAlpha', 0.1)
shading interp
[x y z] = sphere(128);x=L2*x;y=L2*y;z=L2*z;
h = surfl(x+pA2(1), y+pA2(2), z+pA2(3));
set(h, 'FaceAlpha', 0.5)
shading interp
patch([pA1(1),pA2(1),pC1(1),pC2(1),pB1(1),pB2(1)],[pA1(2),pA2(2),pC1(2),pC2(2),pB1(2),pB2(2)],0)
  1 个评论
Adam Danz
Adam Danz 2021-1-6
编辑:Adam Danz 2021-1-6
> How can I show the intersections of two spheres on MATLAB plot?
This has been addressed in the forum several times:

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by