Customized 3D vector representation
조회 수: 6 (최근 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.
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!