如何使用MATLAB检查一个椭圆在另一个椭圆内? [英] How can I check one ellipse is inside the another ellipse by using MATLAB?

查看:294
本文介绍了如何使用MATLAB检查一个椭圆在另一个椭圆内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查找两个椭圆的状态.

I am trying to find the status of two ellipses.

我尝试使用以下代码找到两个椭圆的交点:

I tried to find the intersection of two ellipses by using the following code:

syms x y
a=4;
b=2;
ellipse1 = ((x+10).^2/a.^2)+(y.^2/b.^2)==1;
a1=6;
b1=5;
ellipse2 = ((x-10).^2/a1.^2)+(y.^2/b1.^2)==1;
c = solve(ellipse1,ellipse2);

dX = double(c.x);
dY = double(c.y);

如果省略号不有趣,我得到虚值解.如下所示,有两种可能的假想解决方案:

If ellipses are not interesting, I get the imaginary values solution. There can be two chances for an imaginary solution as shown below:

我如何才能找到椭圆相交或不相交?如果不相交,椭圆(内部或分隔)的位置将是什么? 任何人都可以回复吗?

How can I find the ellipses are intersecting or not? If not intersecting, what will be the positions of ellipses( inside or separated) ? Can anyone reply?

提前谢谢! Manu

Thanks in advance ! Manu

推荐答案

比方说,您已经知道椭圆不相交(即,您从solve()函数获得了一个假想的值解).

Let's say you already know that the ellipses don't intersect (i.e. you got an imaginary values solution from the solve() function).

检查ellipse1的中心(x1,x2)是否在ellipse2内

Check whether the center (x1,x2) of ellipse1 is inside ellipse2

((x1-c1).^2/a1.^2)+((y1-d1).^2/b1.^2) < 1

其中(c1,d1) ellipse2

  • 如果是,您有第二种情况.

  • If it is, you have case two.

否则,您就有第一种情况.

Otherwise, you have case one.

我们知道这一点是因为

  • 如果 ellipse1 内部的任何部分在内部 ellipse2

  • if any part of the interior of ellipse1 is inside the interior of ellipse2

,我们知道两个椭圆不相交,

and we know the two ellipses do not intersect,

那么一个椭圆必须完全包含在另一个椭圆中

Then one ellipse must be completely contained in the other

注意:根据此测试,我们不知道哪个椭圆在另一个椭圆内.

Note: we don't know which ellipse is inside the other based on this test.

这篇关于如何使用MATLAB检查一个椭圆在另一个椭圆内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆