From: Joerg Lehmann <joergl@us...>  20050914 08:14:44

On 14.09.05, Andre Wobst wrote: > Hi, > > On 13.09.05, Dani Marti wrote: > > What is the most straightforward way to plot an ellipse (or something > > that looks like an ellipse, like a deformed circle)? Is any predefined > > path for an ellipse? > > def elipse(x, y, a, b, angle): > t = trafo.scale(unit.topt(a), unit.topt(b)).rotated(angle).translated(x, y) > return path.circle_pt(0, 0, 1).transformed(t) Btw, this makes another class/factory function for our future paths module... > Its fine as long as a and b are not close to zero. For this case two > problems occur: First scale does not work as expected (for a or b > being exactly zero). Jörg, do you remember what the idea was? Then the transformation matrix becomes degenerate, which we somehow wanted to exclude at that time. Maybe, we shouldn't be too strict about that, at least if PostScript doesn't complain in such a case (I didn't check). But for the present case, this is pointless anyway. > I don't > remember/understand it. (A solution could be to change the trafo.scale > or to build our own transformation matrix.) The second problem is > related to the transformed on a small closed object (when a and b are > both almost zero, say 1e10). The later can be solved by > ".normpath(epsilon=None).transformed(t).path()" instead of just > ".transformed(t)". (Jörg, Michael: Here we have a second usecase for > the recent addition of the epsilon=None feature ... ;)). I don't know why this case should be too problematic. Who wants such an ellipse? Jörg 