围绕传单地图中的点旋转多边形
问题描述
我有一个问题,在我的传单地图中,我从多边形创建了一个三角形:
I have an issue, in my leaflet map I've created a triangle from polygon:
我想围绕 Point[decimal_lon, decimal_lat]
旋转这个多边形.但我无法解决它..
我创建了 DEMO,我正在旋转多项式,我想旋转我的三角形(多边形)向您展示我的问题.
and I want to rotate this polygon around Point[decimal_lon, decimal_lat]
. But I'm not able to solve it..
I've created DEMO, where I'm rotating polynom the same I want to rotate my triangle (polygon) to show you my problem.
推荐答案
一种方法是通过矩阵旋转.https://en.wikipedia.org/wiki/Rotation_matrix.您想将该点平移到中心,然后应用旋转,然后将其平移回来.
One way to do it is through matrix rotation. https://en.wikipedia.org/wiki/Rotation_matrix. You want to translate the point to the center then apply the rotation, then translate it back.
这就是你的代码结尾的样子.
This is what the end of your code would look like.
这是一个演示
这篇关于围绕传单地图中的点旋转多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!