Openlayers 3 旋转多点几何
Openlayers 3 Rotate Multipoint geometry
我希望使用多点几何来保存地图上不同的特征点,但我需要围绕一个点旋转它们。
Openlayers 3 是否具有允许我获取多点并围绕其中一个点旋转它的任何功能?
ol.coordinates.rotate()
存在但没有执行我需要的操作。
这是库的一部分还是实现者的三角函数练习?
我最终创建了多个 ol.geom.Point
对象并使用以下函数围绕给定点旋转它们:-
rotateGeometry = function(pointLongitude, pointLatitude, originLongitude, originLatitude, angle) {
angle = angle * Math.PI / 180.0;
return [Math.cos(angle) * (pointX - originX) - Math.sin(angle) * (pointY - originY) + originX, Math.sin(angle) * (pointX - originX) + Math.cos(angle) * (pointY - originY) + originY];
}
输入我的坐标有效。对此的扩展可以是为其提供具有指定轴点的多点几何体,并使用此功能一次旋转围绕它的所有其他几何体。
哦,我必须反转发送的角度才能正确旋转,但这可能是我的实现。
欢迎评论。
我希望使用多点几何来保存地图上不同的特征点,但我需要围绕一个点旋转它们。
Openlayers 3 是否具有允许我获取多点并围绕其中一个点旋转它的任何功能?
ol.coordinates.rotate()
存在但没有执行我需要的操作。
这是库的一部分还是实现者的三角函数练习?
我最终创建了多个 ol.geom.Point
对象并使用以下函数围绕给定点旋转它们:-
rotateGeometry = function(pointLongitude, pointLatitude, originLongitude, originLatitude, angle) {
angle = angle * Math.PI / 180.0;
return [Math.cos(angle) * (pointX - originX) - Math.sin(angle) * (pointY - originY) + originX, Math.sin(angle) * (pointX - originX) + Math.cos(angle) * (pointY - originY) + originY];
}
输入我的坐标有效。对此的扩展可以是为其提供具有指定轴点的多点几何体,并使用此功能一次旋转围绕它的所有其他几何体。
哦,我必须反转发送的角度才能正确旋转,但这可能是我的实现。
欢迎评论。