【问题标题】:How do I calculate a point on a ellipse’s circumference?如何计算椭圆圆周上的点?
【发布时间】:2012-02-23 11:11:18
【问题描述】:

我想在J2ME的椭圆曲线上画一个点

我有 X、Y、宽度、高度和 t 的值。

XY 是椭圆(根据 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)));

这个等式正确吗?或者对于椭圆,我们需要进行更多计算吗?

【问题讨论】:

    标签: math java-me geometry ellipse


    【解决方案1】:

    如果( X, Y ) 是椭圆的中心,宽度和高度是两个轴,那么方程应该是

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

    如果您有所有t 来绘制整个椭圆,则不需要对 Math.sin 进行 -1 乘法。

    【讨论】:

    • @Nguyen:对不起,我认为你弄错了。 AFAIK,( aCos( \th ), bSin( \th ) ) 参数化一个椭圆,当( a == b ) 它变成一个圆。这里a := widthb := height
    猜你喜欢
    • 1970-01-01
    • 2012-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-24
    • 1970-01-01
    相关资源
    最近更新 更多