Increase distance when draw a ellipse
How can i increase the distance when i draw a ellipse from a certain point? This is the code i use to draw a ellipse in c#:
public double[] CalculatePosition(double centerX, double centerY, double angle)
{
double[] position = new double[2];
position[0] = Math.Cos(angle) * radiusX + centerX;
position[1] = Math.Sin(angle) * radiusY + centerY;
return position;
}
draw a ellipse base开发者_StackOverflowd on a point. the function that use this, draw for example 5 ellipses, around the point.
Do you mean the size of the eclipse? In which case, you want to vary radiusX and radiusY.
The best way to do this is to pass them as parameters to the function:
public double[] CalculatePosition(double centerX,
double centerY,
double radiusX,
double radiusY,
double angle)
{
double[] position = new double[2];
position[0] = Math.Cos(angle) * radiusX + centerX;
position[1] = Math.Sin(angle) * radiusY + centerY;
return position;
}
Then you can draw several ellipses around the same point by calling this function several times, and varying radiusX and radiusY.
精彩评论