コード例 #1
0
ファイル: vec2.py プロジェクト: gabriel-augusto/FGAme
    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
コード例 #2
0
ファイル: vec2.py プロジェクト: macartur-UNB/FGAme
    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
コード例 #3
0
ファイル: vec2.py プロジェクト: macartur-UNB/FGAme
    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)
コード例 #4
0
ファイル: vec2.py プロジェクト: gabriel-augusto/FGAme
    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)