Matrix Class rotateX, rotateY and rotateZ methods assume the provide angle is in radians
- Dominant language
- Python
- Stars
- 5.8k
- Forks
- 541
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 5
Description
The rotateX, rotateY and rotateZ methods of the Matrix class assume the angle of rotation is in radians not degrees like all of the other cadquery methods.
```python
import cadquery as cq
import math
print("Unit X Vector rotated about the Z axis by 30 degrees:(",math.cos(math.radians(30)),",",math.sin(math.radians(30)),",0)")
unitXVector = cq.Vector(1,0,0)
m0 = cq.Matrix()
m0.rotateZ(30)
rotatedUnitXVector = m0.multiply(unitXVector)
print("Unit X Vector rotated by rotateZ(30):",rotatedUnitXVector)
m1 = cq.Matrix()
m1.rotateZ(math.radians(30))
rotatedUnitXVector = m1.multiply(unitXVector)
print("Unit X Vector rotated by rotateZ(math.radians(30)):",rotatedUnitXVector)
```
There is one line fix:
```python
def _rotate(self, direction: gp_Ax1, angle: float):
new = gp_Trsf()
# new.SetRotation(direction, angle)
new.SetRotation(direction, math.radians(angle))
self.wrapped = self.wrapped * gp_GTrsf(new)
```
However, this will break backwards compatibility.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.