From: Joerg L. <jo...@us...> - 2005-09-14 11:34:59
|
On 14.09.05, Andre Wobst wrote: > 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 ... ;-) According to PLRM, p. 189, transformation with determinant zero are "not very useful" and can lead to undefinedresult errors "during the execution of graphics and font operators". Oh well, not a very useful statement for a reference either. > 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 ... I really don't know. But I would tend to attempt preventing PS code which is not leading to errors. Jörg |