3

I've already got an ellipse in Asymptote in nice need polar coordinates, but I am trying to illustrate Kepler's Second Law, and it would be nice to fill sectors from one of the foci.

I've already got stuff like enter image description here, but I don't know how to fill in a sector as in pictures like: enter image description here

1
  • Could you provide your asy code ?
    – O.G.
    Feb 21, 2016 at 20:34

1 Answer 1

4

The easiest way will likely depend on the asymptote code that you have already written. If you don't care about the exact angles of the cut, then you could create a subpath of a section of the ellipse like so.

unitsize(1inch);

real a = 1.0;
real b = 0.8;
pair f = (sqrt(a*a - b*b), 0);

path ell = scale(a,b)*unitcircle;
path sector = subpath(ell, 2.5, 2.9);

filldraw(sector--f--cycle, yellow);
draw(ell);
draw(sector, 1+red);
dot(f, 6+red);

enter image description here

If you want to specify exact angles for the sector, then you can intersect the ellipse with a rays shooting from the focus at the desired angles.

unitsize(1inch);

real a = 1.0;
real b = 0.8;
pair f = (sqrt(a*a - b*b), 0);
real angle1 = 90;
real angle2 = 180;

path ell = scale(a,b)*unitcircle;

path sector = subpath(ell,
        intersect(ell, f--f+rotate(angle1)*(10,0))[0],
        intersect(ell, f--f+rotate(angle2)*(10,0))[0]);

filldraw(sector--f--cycle, yellow);
draw(ell);
draw(sector, 1+red);
dot(f, 6+red);

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .