MCPcopy Create free account
hub / github.com/apache/xmlgraphics-fop / rotate

Method rotate

fop-core/src/main/java/org/apache/fop/area/CTM.java:181–200  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 4

getCTMandRelDimsMethod · 0.95
generatePDFMethod · 0.45
smokeTestMethod · 0.45
createTestImageMethod · 0.45

Calls 1

multiplyMethod · 0.95

Tested by 2

smokeTestMethod · 0.36
createTestImageMethod · 0.36