フィルターのクリア

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 Center および File ExchangeBartlett についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by