Dear all,
I have a 3D point set which I would like to plot as connected line segments. In addition, I would like the points (lines) furthest away (from the point of perspective) to appear more distant by having an alpha gradient, i.e points closer to the viewer should have higher alpha values than those further away (like looking in a fog).
I tried using
mfig=patch(p(:,1),p(:,2),p(:,3));
set(mfig,'facealpha',0);
set(mfig,'edgealpha',...
and then play with the different alphamappings but unfortunately I don't get it to work.
Does anyone know how to do this (if possible)?
Thanks!
Cheers, Filip

 채택된 답변

Jonathan Sullivan
Jonathan Sullivan 2012년 2월 7일

0 개 추천

amap = linspace(1,0,size(p,1))';
set(mfig,'FaceColor','none','EdgeColor','flat',...
'LineWidth',3,'FaceVertexAlphaData',amap,...
'EdgeAlpha','interp');

댓글 수: 3

Filip Persson
Filip Persson 2012년 2월 7일
Hi Jonathan,
Unfortunately it doesn't work; I get the following message
Warning: Patch FaceVertexCData length (0) must equal
Vertices length (233) for flat EdgeColor
Do you know what it means?
Thanks for helping me out!
Try adding
'FaceVertexCData', ones(size(amap))
Filip Persson
Filip Persson 2012년 2월 8일
It works!
Thanks to Jonathan and Walter!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Filip Persson
Filip Persson 2012년 2월 8일

0 개 추천

The working script:
amap = linspace(1,0,233)';
mfig=patch(p(:,1),p(:,2),p(:,3),'red');
set(mfig,'facealpha',0);
set(mfig,'FaceColor','none','EdgeColor','flat',...
'LineWidth',3,'FaceVertexAlphaData',amap,...
'EdgeAlpha','interp',...
'FaceVertexCData', ones(size(amap)));

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2012년 2월 7일

편집:

2013년 10월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by