필터 지우기
필터 지우기

Circle projection to be ellipse on the ground

조회 수: 30 (최근 30일)
Mirzobek Malikov
Mirzobek Malikov 2022년 8월 25일
편집: Matt J 2022년 8월 26일
Have an ellipse with r2 - major axis and r1 - minor axis, and tilted at some degree. Above of the ellipse at some arbitrary height need to draw a circle with radius r2. Theoritically, if we incline the circle under degree, it's projection to the ground plane must give us the ellipse.
For that, I have tried by using the rotate function. I have used it two time in the scretch. First, I inclined the circle around x-axis. Second, by saving the last properties of the first rotation, I have used them to rotate around z-axis. As a result, I have had kinda desirable but not well. I was working on the matter during this week, but still can't get a good result.
Here's my code:
% r1 and r2, minor and major axis of the ellipse
% xm and ym are mean values of the ellipse x and y parametres, so center of the circle and ellipse is the same
%
% circle draw
r = r2;
teta = linspace(0, 2*pi, 100);
x = r*cos(teta) + xm;
y = r*sin(teta) + ym;
z = 10*ones(1,length(x));
inclined_angle = acosd(r1/r2);
g = plot3(x, y, z);
grid on
xlabel('x')
ylabel('y')
zlabel('z')
rotate(g, [1 0 0], inclined_angle);
newx = g.XData;
newy = g.YData;
newz = g.ZData;
gg = plot3(newx, newy, newz);
rotate(gg, [0 0 1], alpha)
grid on
xlabel('x')
ylabel('y')
zlabel('z')
% ellipse
hold on
plot(xrange, yrange, 'color', [0.9290 0.6940 0.1250], 'LineWidth', 1.6);
Also,
xm = -0.769, ym = -0.148, r1 = 6.867, r2 = 10.073, alpha = 18.372, inclined_angle = 47.022
I have attached here some data of xrange and yrange for the ellipse in txt. files and my resultant plots.
3D:
if we look from above, 2D: From this picture we can see tha projection of the circle is not exactly on our ellipse, on a bit different positions. I need to find the besst solution for it.
I would be so appriciated if somebody help me to handle this issue.
  댓글 수: 9
Matt J
Matt J 2022년 8월 25일
To get xrange and yrange data, open the txt files, then copy it and past in Matlab command window by equalizing to variables xrange and yrange is recommended.
I have a better idea. Why don't you include xrange, yrange for us in a .mat file, which can be straightfowardly loaded in.
Mirzobek Malikov
Mirzobek Malikov 2022년 8월 25일
sorry, i am rookie to Matlab. Here I have uploaded .mat files of xrange and yrange

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

답변 (1개)

Matt J
Matt J 2022년 8월 25일
편집: Matt J 2022년 8월 25일
The final position of the projected ellipse will depend on the z-coordinates that you have before the rotation.
z = 10*ones(1,length(x));
You don't seem to have accounted for that anywhere in your comparison.
  댓글 수: 4
Mirzobek Malikov
Mirzobek Malikov 2022년 8월 25일
편집: Mirzobek Malikov 2022년 8월 25일
no.
my aim is to get this picture
Matt J
Matt J 2022년 8월 25일
편집: Matt J 2022년 8월 26일
Download this,
and then,
x = r*cos(teta) + xm;
y = r*sin(teta) + ym;
z = 10*ones(1,length(x));
XYZ=num2cell( AxelRot([x;y;z],inclined_angle,[1,0,0],[xm,ym,z(1)]) ,1);
[newx,newy,~]=deal(XYZ{:});
plot(xnew,ynew,xrange,yrange,'x')

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by