Exemplo n.º 1
0
    def _irotate(self, theta, axis=(0, 0)):
        '''Rotaciona o vetor *inplace*'''

        x, y = axis
        dx = self.x - x
        dy = self.y - y
        cos_t, sin_t = m.cos(theta), m.sin(theta)
        self.x = dx * cos_t - dy * sin_t + x
        self.y = dx * sin_t + dy * cos_t + y
Exemplo n.º 2
0
    def _irotate(self, theta, axis=(0, 0)):
        '''Rotaciona o vetor *inplace*'''

        x, y = axis
        dx = self.x - x
        dy = self.y - y
        cos_t, sin_t = m.cos(theta), m.sin(theta)
        self.x = dx * cos_t - dy * sin_t + x
        self.y = dx * sin_t + dy * cos_t + y
Exemplo n.º 3
0
    def rotate(self, theta, axis=(0, 0)):
        '''Retorna um vetor rotacionado por um ângulo theta'''

        x, y = axis
        dx = self.x - x
        dy = self.y - y
        cos_t, sin_t = m.cos(theta), m.sin(theta)
        return self._from_coords(dx * cos_t - dy * sin_t + x,
                                 dx * sin_t + dy * cos_t + y)
Exemplo n.º 4
0
    def rotate(self, theta, axis=(0, 0)):
        '''Retorna um vetor rotacionado por um ângulo theta'''

        x, y = axis
        dx = self.x - x
        dy = self.y - y
        cos_t, sin_t = m.cos(theta), m.sin(theta)
        return self._from_coords(
            dx * cos_t - dy * sin_t + x,
            dx * sin_t + dy * cos_t + y)