MCPcopy Index your code
hub / github.com/python/cpython / rotate

Method rotate

Lib/turtle.py:265–271  ·  view source on GitHub ↗

rotate self counterclockwise by angle

(self, angle)

Source from the content-addressed store, hash-verified

263 def __abs__(self):
264 return math.hypot(*self)
265 def rotate(self, angle):
266 """rotate self counterclockwise by angle
267 """
268 perp = Vec2D(-self[1], self[0])
269 angle = math.radians(angle)
270 c, s = math.cos(angle), math.sin(angle)
271 return Vec2D(self[0]*c+perp[0]*s, self[1]*c+perp[1]*s)
272 def __getnewargs__(self):
273 return (self[0], self[1])
274 def __repr__(self):

Callers 3

test_rotateMethod · 0.95
_rotateMethod · 0.45
_rotateMethod · 0.45

Calls 2

radiansMethod · 0.80
Vec2DClass · 0.70

Tested by 1

test_rotateMethod · 0.76