| Conditions | 4 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | "Some utility methods" |
||
| 25 | def rotation(theta, axis=-1): |
||
| 26 | """ |
||
| 27 | Return a rotation matrix around axis |
||
| 28 | 0:x, 1:y, 2:z |
||
| 29 | """ |
||
| 30 | ct = cos(theta) |
||
| 31 | st = sin(theta) |
||
| 32 | |||
| 33 | if axis in (0, -3): |
||
| 34 | return np.array([[1, 0, 0], |
||
| 35 | [0, ct, st], |
||
| 36 | [0, -st, ct]]) |
||
| 37 | |||
| 38 | if axis in (1, -2): |
||
| 39 | return np.array([[ct, 0, st], |
||
| 40 | [0, 1, 0], |
||
| 41 | [-st, 0, ct]]) |
||
| 42 | |||
| 43 | if axis in (2, -1): |
||
| 44 | return np.array([[ct, st, 0], |
||
| 45 | [-st, ct, 0], |
||
| 46 | [0, 0, 1]]) |
||
| 47 | |||
| 59 |