Customized 3D vector representation

조회 수: 6 (최근 30일)
Roderick
Roderick 2024년 2월 6일
댓글: Roderick 2024년 2월 6일
Hello everyone
I was wondering if it would be possible to customize the way in which the directionality of a three-dimensional vector is represented in MatLab, in such a way that the arrow has volume and presents a sphere at half its length, as in this image, which is shown can be found in the paper Domain wall dynamics in two-dimensional van der Waals ferromagnets
and that if I recall correctly has been done with povray.

채택된 답변

Matt J
Matt J 2024년 2월 6일
편집: Matt J 2024년 2월 6일
The graphical element you describe can be created from a combination of a cylinder (the shaft of the arrow), a cone (the head of the arrow) and a sphere. All 3 can be co-plotted using a very simple interface with this FEX package:
Below is an example specific to your goals. Note that once you have the vector H of graphics handles, you can use hgtransform to re-position, resize, and re-orient the arrow to your liking.
[shaftCenter,shaftRadius,shaftHeight]=...
deal([0 0 0], 0.2, 10); %Arrow shaft parameters
[headTip,headAngle,headHeight]=...
deal([1.1*shaftHeight/2,0,0], 30, shaftHeight/6); %Arrow head parameters
[sphereCenter,sphereRadius]=deal([0,0,0], shaftHeight/12); %Sphere parameters
Shaft=cylindricalFit.groundtruth([],shaftCenter,shaftRadius,shaftHeight,[0,0]); %Data-less ground truth objects
Head=rightcircularconeFit.groundtruth([],headTip,headAngle,headHeight,[180,0]);
Sphere=sphericalFit.groundtruth([], sphereCenter,sphereRadius);
figure
hold on
H(1)=plot(Shaft,{'FaceAlpha',1});
H(2)=plot(Head,{'FaceAlpha',1});
H(3)=plot(Sphere,{'FaceAlpha',1});
view(-50,30)
hold off
  댓글 수: 1
Roderick
Roderick 2024년 2월 6일
Hi @Matt J. Thank you very much for your answer! I will try what you suggest. I have found this interesting arrow format example: magnetic skyrmion visualization. Get rid off the sphere sounds reasonable, given the very good output.

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

추가 답변 (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