Next / Previous / Contents / Shipman's homepage

7.7. Pt.radial(): Point at a given distance and bearing

This method is basically a translation using polar coordinates, so the x offset from self is r cos θ, and the y offset is r sin θ.
# - - -   P t . r a d i a l

    def radial(self, d, bearing):
        '''Return the point at a given distance and bearing.
        return Pt(self.x() + d*num.cos(bearing),
                  self.y() + d*num.sin(bearing) )