在具有中心点,高度和宽度的矩形内部的椭圆圆周上找到一个点? [英] finding a point on an ellipse circumference which is inside a rectangle having center point, height and width?

查看:136
本文介绍了在具有中心点,高度和宽度的矩形内部的椭圆圆周上找到一个点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我知道那个矩形的宽度,高度和中心点。

我在.NET中绘制了一个矩形,绘制了一个椭圆。 b
$ b

当然矩形的中心点也是椭圆的中心点。



我知道如何计算点一个圆,但我不知道椭圆。



我有这些参数和角度,我需要椭圆上的点,有人可以发布公式吗?



我看到你需要计算2个点,其中2个半径将会去,半径的总和将被固定,并且他们会相应地改变大小。



我不知道该怎么做,我只有矩形的高度,宽度和中心点以及我希望找到的角度。



感谢您的帮助
Shlomi

解决方案

您可以使用极坐标中的规范形式,分别处理矩形的宽度和高度分别为 w h 的问题。







其中 t 是以弧度表示的角度, a w / 2 b h / 2



所以要绘制你的椭圆,你所要做的就是改变 t 0 360度(以弧度表示,所以它是 0 2pi ),并取决于您如何隔开空间,你会得到椭圆上的点。



由于你的矩形不是居中在原点,所以你必须用中心的坐标偏移它例如,(C x ,C y

  CON st double C_x = 10,C_y = 20,w = 40,h = 50; (双t = 0; t <= 2 * pi; t + = 0.01)
{
double X = C_x +(w / 2)* cos(t)
double Y = C_y +(h / 2)* sin(t);
//根据X& Y here
}


I have a rectangle in .NET in which I draw an ellipse.

I know the width, height and center point of that rectangle.

Of course the center point of the rectangle is also the center point of the ellipse.

I know how to calculate a point on a circle, however I have no clue about an ellipse.

I have those parameters and an angle, i need the point on the ellipse, can someone post the formula?

I saw somewhere you need to calculate 2 points in which 2 radii will go, the sum of the radii will be fixed and they will change in size accordingly.

I don't know how to do that, I only have the rectangle height, width and center point and of course the angle I wish to find the point at.

thanks for any help Shlomi

解决方案

You can use the canonical form in polar coordinates for your problem where the width and height of a rectangle is w and h respectively.

where t is an angle in radians, a is w/2 and b is h/2

So to plot your ellipse, all you have to do is vary t from 0 to 360 degrees (in radians so that's 0 and 2pi) and depending on how you space out t, you get the points on the ellipse.

Since your rectangle is not centered at the origin, you will have to offset it by the coordinates of the center of the rectangle, say, (Cx,Cy)

const double C_x = 10, C_y = 20, w = 40, h = 50;
for(double t = 0; t <=2*pi; t+=0.01)
{
   double X = C_x+(w/2)*cos(t);
   double Y = C_y+(h/2)*sin(t);
   // Do what you want with X & Y here 
}

这篇关于在具有中心点,高度和宽度的矩形内部的椭圆圆周上找到一个点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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