Creates a Matrix33 to rotate by |deg| about a pivot point at (0, 0). @param deg rotation angle in degrees (positive rotates clockwise) @return Matrix33 with rotation
(float deg)
| 151 | * @return Matrix33 with rotation |
| 152 | */ |
| 153 | @NotNull |
| 154 | public static Matrix33 makeRotate(float deg) { |
| 155 | double rad = Math.toRadians(deg); |
| 156 | double sin = Math.sin(rad); |
| 157 | double cos = Math.cos(rad); |
| 158 | double tolerance = 1f / (1 << 12); |
| 159 | if (Math.abs(sin) <= tolerance) sin = 0; |
| 160 | if (Math.abs(cos) <= tolerance) cos = 0; |
| 161 | return new Matrix33(new float[] { |
| 162 | (float) cos, (float) -sin, 0, |
| 163 | (float) sin, (float) cos, 0, |
| 164 | 0, 0, 1 |
| 165 | }); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Creates a Matrix33 to rotate by |deg| about a pivot point at pivot. |
no outgoing calls