/*
* This functions returns an array containing 36 points to draw an
* ellipse.
*
* @param x {double} X coordinate
* @param y {double} Y coordinate
* @param a {double} Semimajor axis
* @param b {double} Semiminor axis
* @param angle {double} Angle of the ellipse
*/
private function calculateEllipse(x:Number, y:Number, a:Number, b:Number, angle:Number, steps:Number = 36 ):Array
{
var points:Array = [];
// Angle is given by Degree Value
var beta:Number = -angle * (Math.PI / 180); //(Math.PI/180) converts Degree Value into Radians
var sinbeta:Number = Math.sin(beta);
var cosbeta:Number = Math.cos(beta);
for (var i:Number = 0; i < 360; i += 360 / steps)
{
var alpha:Number = i * (Math.PI / 180) ;
var sinalpha:Number = Math.sin(alpha);
var cosalpha:Number = Math.cos(alpha);
var X:Number = x + (a * cosalpha * cosbeta - b * sinalpha * sinbeta);
var Y:Number = y + (a * cosalpha * sinbeta + b * sinalpha * cosbeta);
points.push(new Point(X, Y));
}
return points;
}