问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/9411861/how-do-i-calculate-a-point-on-a-ellipse-s-circumference