How to Draw an ellipsoid between two 3d coordinates

조회 수: 4 (최근 30일)
yaacov yehuda-zada
yaacov yehuda-zada 2021년 7월 25일
댓글: darova 2021년 7월 27일
Hi, I want to draw a 3d ellipsoid between two 3d coordinates x1,y1,z1 and x2,y2,z2. The ellipsoid need to be rotated so its top and buttom touch the coordinates. It should have height of r derived from square root and thickness of r/10.Any help please.so far I manage to draw the ellipsoid using ellipsoid() and draw it using surf in the center of axis. I dont know how to calculate and add the required angles to rotate it and the offset.Thanks.

답변 (2개)

darova
darova 2021년 7월 26일
Use rotate to rotate the ellipsoid
  댓글 수: 2
yaacov yehuda-zada
yaacov yehuda-zada 2021년 7월 27일
How do I calculate the required angles for the rotation? I only have the points. Thanks.
darova
darova 2021년 7월 27일
Use cart2sph
p1 = [1 2 1]; % first point
p2 = [2 5 1]; % second point
[az,el,r] = cart2sph(p2-p1); % find two angles and distance

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


Matt J
Matt J 2021년 7월 26일
편집: Matt J 2021년 7월 26일
Another way would be to use the ellipsoidalFit.groundTruth method in this File Exchange submission.
P1=[x1,y1,z1]; P2=[x2,y2,z2];
center=(P1+P2)/2;
r=norm(P2-P1)/2;
ABC=[r, r/10 , r/10];
[az,el,~]=cart2sph(x2-x1,y2-y1,z2-z1);
plot( ellipsoidalFit.groundtruth([],center,ABC,[az,-el,0]*180/pi) );

카테고리

Help CenterFile Exchange에서 Computational Geometry에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by