
from piscript.PiModule import *
init("label", 200, 190)
beginpage()
center()
scale(96, 80)
# a non-uniform scaling

newpath()
circle(1)
stroke()
# the non-uniformity means a circle is really an ellipse

# we want to place a label "A" at the top of the ellipse
gsave()
gs = revert()
# gs is now the current graphics state
# revert changes the coordinate system back to the default
# intuitively, it `undoes' the change from default to current coordinates
v = gs.transform([0, 1])
# v is the vector which in the original coordinate system is (1, 0)
# the top of the ellipse but now expressed in default coordinates 
translate(v)
# we have translated the origin to that point 

newpath()
circle(2)
# because we are now in default coordinates
# this is a true circle of radius 2 points
fill(1)
stroke()

translate(-4, 4)
# still in units of points
t = texinsert("A")
place(t)
grestore()

# -----------------------------------

endpage()
finish()

