def orientation(self, theta=0.0): '''Retorna um vetor unitário na direção em que o objeto está orientado. Pode aplicar um ângulo adicional a este vetor fornecendo o parâmetro _theta.''' theta += self._theta return Vec2(cos(theta), sin(theta))
def _vertices(self, N, pos): length = self.length alpha = pi / N theta = 2 * alpha b = length / (2 * sin(alpha)) P0 = Vec2(b, 0) pos = Vec2(*pos) return [(P0.rotate(n * theta)) + pos for n in range(N)]