Rotate this CTM by "angle" radians and return a new result CTM. This is used to account for reference-orientation. @param angle The angle in radians. Positive angles are measured counter- clockwise. @return CTM The result of rotating this CTM.
(double angle)
| 179 | * @return CTM The result of rotating this CTM. |
| 180 | */ |
| 181 | public CTM rotate(double angle) { |
| 182 | double cos; |
| 183 | double sin; |
| 184 | if (angle == 90.0 || angle == -270.0) { |
| 185 | cos = 0.0; |
| 186 | sin = 1.0; |
| 187 | } else if (angle == 270.0 || angle == -90.0) { |
| 188 | cos = 0.0; |
| 189 | sin = -1.0; |
| 190 | } else if (angle == 180.0 || angle == -180.0) { |
| 191 | cos = -1.0; |
| 192 | sin = 0.0; |
| 193 | } else { |
| 194 | double rad = Math.toRadians(angle); |
| 195 | cos = Math.cos(rad); |
| 196 | sin = Math.sin(rad); |
| 197 | } |
| 198 | CTM rotate = new CTM(cos, -sin, sin, cos, 0, 0); |
| 199 | return multiply(rotate); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Translate this CTM by the passed x and y values and return a new result CTM. |