File: code_block0.py

package info (click to toggle)
python-traitsui 8.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,232 kB
  • sloc: python: 58,982; makefile: 113
file content (18 lines) | stat: -rw-r--r-- 377 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# code_block0.py

from numpy import cos, sin


class Point(object):
    """3D Points objects"""

    x = 0.0
    y = 0.0
    z = 0.0

    def rotate_z(self, theta):
        """rotate the point around the Z axis"""
        xtemp = cos(theta) * self.x + sin(theta) * self.y
        ytemp = -sin(theta) * self.x + cos(theta) * self.y
        self.x = xtemp
        self.y = ytemp