MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _polytrafo

Method _polytrafo

tools/python-3.11.9-amd64/Lib/turtle.py:2969–2979  ·  view source on GitHub ↗

Computes transformed polygon shapes from a shape according to current position and heading.

(self, poly)

Source from the content-addressed store, hash-verified

2967
2968
2969 def _polytrafo(self, poly):
2970 """Computes transformed polygon shapes from a shape
2971 according to current position and heading.
2972 """
2973 screen = self.screen
2974 p0, p1 = self._position
2975 e0, e1 = self._orient
2976 e = Vec2D(e0, e1 * screen.yscale / screen.xscale)
2977 e0, e1 = (1.0 / abs(e)) * e
2978 return [(p0+(e1*x+e0*y)/screen.xscale, p1+(-e0*x+e1*y)/screen.yscale)
2979 for (x, y) in poly]
2980
2981 def get_shapepoly(self):
2982 """Return the current shape polygon as tuple of coordinate pairs.

Callers 2

_drawturtleMethod · 0.95
stampMethod · 0.95

Calls 2

Vec2DClass · 0.85
absFunction · 0.70

Tested by

no test coverage detected