如何计算椭圆圆周上的点? [英] How do I calculate a point on a ellipse’s circumference?

查看:175
本文介绍了如何计算椭圆圆周上的点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有X,Y,宽度,高度和t值。

$ b $在J2ME中绘制椭圆曲线中的点b b X Y 是椭圆(根据J2ME)相对于Canvas的位置, t 是相对于椭圆中心的角度(我有问题的图像表示,但不幸的博客不允许插入讨论:))

  int ePX =(X + width)+(int)(width * Math.cos(Math.toRadians(t))); 
int ePY =(Y + height)+(int)(height * -Math.sin(Math.toRadians(t)));

这个方程是否正确?如果(X,Y)是椭圆的中心,那么我们需要进行更多的计算?

并且宽度和高度是两个轴,那么方程应该是bb
$ b pre code int ePX = X +(int)(width * Math名为.cos(Math.toRadians(T)));
int ePY = Y +(int)(height * Math.sin(Math.toRadians(t)));

如果所有的 t都不需要-1与Math.sin的乘法运算绘制整个椭圆。


I want to plot a point in elliptical curve in J2ME

I have values for X,Y,width,height and t.

X and Y are the position of the ellipse(according to J2ME) with respect to Canvas and t is angle with respect to the center of ellipse(I have an image representation of the problem , but unfortunate blog is not allowing to insert into discussion :) )

int ePX = (X + width)+ (int) (width * Math.cos(Math.toRadians(t)));
int ePY = (Y + height)+ (int) (height * -Math.sin(Math.toRadians(t)));

Is this equation correct? or for ellipse do we need to have some more calculations?

解决方案

If ( X, Y ) is the center of the ellipse, and width and height are the two axes, then the equation should be

int ePX = X + (int) (width  * Math.cos(Math.toRadians(t)));
int ePY = Y + (int) (height * Math.sin(Math.toRadians(t)));

The -1 multiplication to Math.sin is unnecessary if you have all t to draw the entire ellipse.

这篇关于如何计算椭圆圆周上的点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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