필터 지우기
필터 지우기

Transparent Sphere on a Polygon Plot

조회 수: 2 (최근 30일)
ercan duzgun
ercan duzgun 2021년 1월 6일
댓글: ercan duzgun 2021년 1월 6일
I want to create a transparent sphere. First I plot a polygon, then I plot a transparent sphere (according to this: https://www.mathworks.com/matlabcentral/answers/59536-how-to-create-a-transparent-sphere), but the first polygon doesn't appear in the transparent sphere. Even though I plot the polygon over sphere, it still doesn't appear. How should I do that? Many thanks. 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;
[x y z] = sphere(128);x=L1*x;y=L1*y;z=L1*z;
h = surfl(x, y, z);
set(h, 'FaceAlpha', 0.1)
shading interp

채택된 답변

WalterWhite
WalterWhite 2021년 1월 6일
try using flat shading (shading flat) instead of interpolating colormap shading (shading interp)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by