| 93 | |
| 94 | |
| 95 | def rotateXYZ(x, y, z, ax, ay, az): |
| 96 | # NOTE: Rotates around the origin (0, 0, 0) |
| 97 | |
| 98 | # Rotate along x axis: |
| 99 | rotatedX = x |
| 100 | rotatedY = (y * math.cos(ax)) - (z * math.sin(ax)) |
| 101 | rotatedZ = (y * math.sin(ax)) + (z * math.cos(ax)) |
| 102 | x, y, z = rotatedX, rotatedY, rotatedZ |
| 103 | |
| 104 | # Rotate along y axis: |
| 105 | rotatedX = (z * math.sin(ay)) + (x * math.cos(ay)) |
| 106 | rotatedY = y |
| 107 | rotatedZ = (z * math.cos(ay)) - (x * math.sin(ay)) |
| 108 | x, y, z = rotatedX, rotatedY, rotatedZ |
| 109 | |
| 110 | # Rotate along z axis: |
| 111 | rotatedX = (x * math.cos(az)) - (y * math.sin(az)) |
| 112 | rotatedY = (x * math.sin(az)) + (y * math.cos(az)) |
| 113 | rotatedZ = z |
| 114 | |
| 115 | return (rotatedX, rotatedY, rotatedZ) |
| 116 | |
| 117 | |
| 118 | def transformPoint(point1, point2, scalex=None, scaley=None, translatex=None, translatey=None): |