From: Andre Wobst <wobsta@us...>  20050914 08:41:12

On 14.09.05, Joerg Lehmann wrote: > > 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... Right. > > 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). I didn't either. Maybe that's the point. Otherwise I don't see any reason for this restriction. Beside that the checks are strange, they're even wrong for the case of b=0, which lead to a circle instead of a line. Again, a marker issue here ... ;) > But for the present case, this is pointless anyway. Not really, it just shouldn't break. See below. > > 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? Well, the ellipse should just work. Suppose you're using it in a graph style with flexible size given by the data values you put in. Like for circles in the first graphstyle example. It just shouldn't break. It doesn't even break for negative values so why should it for zero or something close to zero ... André  by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX  High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ 