如何在给定角度的情况下在椭圆的轮廓上得到一个点? [英] How to get a point on an ellipse's outline given an angle?

查看:62
本文介绍了如何在给定角度的情况下在椭圆的轮廓上得到一个点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我给出了椭圆-它们由它们的中点,水平半径(rh)和垂直半径(rv)定义.我正在使用sin/cos绘制它们,结果对我来说看起来相当不错(只需确保这不是一个错误源).

So, I have ellipses given - they are defined by their midpoint, an horizontal radius(rh) and an vertical radius(rv). I'm drawing them using sin/cos and the result looks fairly good to me(just making sure this isn't an error source).

现在说我有一个给定的角度(或方向矢量),我想在椭圆轮廓上具有该角度/方向的点.我的直观方法是简单地使用方向矢量,对其进行归一化,然后将其x分量乘以rh,将其y分量乘以rv.现在我写的程序和我在纸上所做的所有计算都没有给我想要的要点,而是给了我一个要点,尽管它仍然在椭圆的轮廓上.但是,如果方向是(1,0),(0、1),(-1、0),(0,-1)之一,则此方法就可以正常工作(因此,它适用于0°,90°,180°,270°).

Now say I have an angle(or a direction vector) given and I want to have the point on the ellipse's outline with that angle/direction. My intuitive approach was to simply use the direction vector, normalise it and multiply its x-component with rh, its y-component with rv. Now both my written program AND all the calculations I did on a paper give me not the point I want but another one, though it's still on the ellipse's outline. However, this method works just fine if the direction is one of (1,0), (0, 1), (-1, 0), (0, -1), (so it works for 0°, 90°, 180°, 270°).

尽管互联网上关于椭圆本身的数据非常多,但我找不到有关我的特定问题的任何信息-我无法找到比上述解决方案更好的解决方案.

Although there is a farily big amount of data about ellipses themselves on the internet, I couldn't find any information about my particular problem - and I couldn't come up with any better solution than the above one.

那么,有什么想法要实现这一目标吗?

So, any idea how to achieve this?

推荐答案

如果我了解您的要求,那么我认为您需要的是

If I understand what you are asking then I think that what you need is polar form of an ellipse where the angle is measured from the ellipse centre. Using this form of the ellipse, you will be able to evaulate your elliptic radius value for a given choice of theta and then plot your point.

如果您查看此gif图像,您将了解为什么使用参数角度只能在仅为您提供正确的结果度 http://en.wikipedia.org/wiki/File:Parametric_ellipse.gif.对椭圆使用极坐标形式,您应该得到想要的点.

If you take a look at this gif image you will see why using the parametric angle give you the correct result only at theta = 90, 180, 270 and 360 degrees http://en.wikipedia.org/wiki/File:Parametric_ellipse.gif . Use the polar form for an ellipse and you should get the points that you want.

这篇关于如何在给定角度的情况下在椭圆的轮廓上得到一个点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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