MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / rotate

Method rotate

src/openlayers/overlay/theme/Theme.js:508–512  ·  view source on GitHub ↗

* @function Theme.prototype.rotate * @description 获取某像素坐标点 pixelP 绕中心 center 逆时针旋转 rotation 弧度后的像素点坐标。 * @param {number} pixelP - 像素坐标点位置。 * @param {number} rotation - 旋转角度。 * @param {number} center - 中心位置。 * @returns {Array. } 旋转后的像素坐标数组。

(pixelP, rotation, center)

Source from the content-addressed store, hash-verified

506 * @returns {Array.<number>} 旋转后的像素坐标数组。
507 */
508 rotate(pixelP, rotation, center) {
509 var x = Math.cos(rotation) * (pixelP[0] - center[0]) - Math.sin(rotation) * (pixelP[1] - center[1]) + center[0];
510 var y = Math.sin(rotation) * (pixelP[0] - center[0]) + Math.cos(rotation) * (pixelP[1] - center[1]) + center[1];
511 return [x, y];
512 }
513
514 /**
515 * @function Theme.prototype.scale

Callers 2

fireMethod · 0.95
getLocalXYMethod · 0.95

Calls 2

cosMethod · 0.80
sinMethod · 0.80

Tested by

no test coverage detected