Next / Previous / Contents / Shipman's homepage

13. class Polar: A point in polar coordinates

homcoord.py
# - - - - -   c l a s s   P o l a r

class Polar(object):
    '''Represents a point in polar coordinates.

      Exports:
        Polar(r, theta):
          [ r and theta are numbers ->
              return a new Polar instance representing radius r
              and angle theta ]
        .r, .theta:  [ as passed to constructor ]
        .toCartesian():
          [ return self in Cartesian coordinates as a Pt instance ]
        .__str__():
          [ return self as a string "(r, theta)" ]
    '''