Customized 3D vector representation

2 次查看(过去 30 天)
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 个评论
Richard Wood
Richard Wood 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 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by