Gimp
view release on metacpan or search on metacpan
examples/burst view on Meta::CPAN
# dimensions for an "inside ellipse"
my $c = ($a>$b)?$inside_pixels:$inside_pixels*$a/$b;
my $d = ($a>$b)?$inside_pixels*$b/$a:$inside_pixels;
# get the slope
my $m = sin($angle)/cos($angle);
if ($m ==0) { $m = 0.000000000001; } #avoid div by 0
if ($c ==0) { $c = 0.000000000001; } #avoid div by 0
if ($d ==0) { $d = 0.000000000001; } #avoid div by 0
# find the positive solution of the quadratic for the endpoints
my $x = sqrt(1/((1/$a/$a)+($m*$m/$b/$b)));
my $y = sqrt(1/((1/($m*$m*$a*$a))+(1/$b/$b)));
# and find the starting points in the same manner
my $x_start = sqrt(1/((1/$c/$c)+($m*$m/$d/$d)));
my $y_start = sqrt(1/((1/($m*$m*$c*$c))+(1/$d/$d)));
# pick the right solution of the quadratic
if ((find_in_2pi($angle) < PI/2) ||
(find_in_2pi($angle) > 3*PI/2))
( run in 0.713 second using v1.01-cache-2.11-cpan-beeb90c9504 )