Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: William Henney <w.henney@as...>  20061227 03:32:52

Hi On 12/26/06, kib2 <kib2@...> wrote: > In pyx.trafo.trafo, I don't understand how the mirror is implemented. > > As far as I know, to obtain a mirror at line passing through (0,0) with > the given angle "angle", the matrix should be like this: > ((math.cos(2*angle),math.sin(2*angle)),(math.sin(2*angle),math.cos(2*ang= le))). > > > But it is given like this: > ( (math.cos(phi)*math.cos(phi)math.sin(phi)*math.sin(phi), > 2*math.sin(phi)*math.cos(phi) ), > (2*math.sin(phi)*math.cos(phi), > math.sin(phi)*math.sin(phi)math.cos(phi)*math.cos(phi) ) ) > > There are problems with i.e a 135 degrees given angle. > But these are exactly the same, except for the sign of the angle (recall your high school trig identities!). Your matrix is correct for angles measured clockwise from the xaxis, but PyX is assuming that the angle is measured *anti*clockwise from the xaxis (which is the more common convention I think). On the other hand, I don't see why PyX has expanded out the double angle formulae  your version seems to have a lower operation count. > My other question is relative to the transparency in pdf output. The > documentation is rather limited on this, and I found no sample. > How can I fill a given path with transparency and stroke it (without > transparency) at the same time ? I don't think that you can do this with the builtin methods, but there is no reason why you can't roll your own. Something like this:  import pyx class mycanvas(pyx.canvas.canvas): "Just like pyx.canvas.canvas, but adds a strokefill method." def strokefill(self, path, strokeattrs=3D[], fillattrs=3D[], commonattr= s=3D[]): =09self.stroke(path, strokeattrs+commonattrs) =09self.fill(path, fillattrs+commonattrs) c =3D mycanvas() p =3D pyx.path.circle(0, 0, 1) translucent =3D pyx.color.transparency(0.7) blue =3D pyx.color.rgb(0.1, 0.2, 0.5) red =3D pyx.color.rgb(0.9, 0.4, 0.3) # blue solid stroke, red translucent fill c.strokefill(p, [blue], [red, translucent]) # red solid stroke, blue translucent fill, shifted c.strokefill(p, [red], [blue, translucent], [pyx.trafo.translate(0.5, 0.5)]= ) c.writePDFfile("strokefilltest")  Cheers Will =20 Dr William Henney, Centro de Radioastronom=EDa y Astrof=EDsica, Universidad Nacional Aut=F3noma de M=E9xico, Campus Morelia 