Quantcast
Channel: rotate polygon around point in leaflet map - Stack Overflow
Browsing index pages (4 articles)

rotate polygon around point in leaflet map

I have an issue, in my leaflet map I've created a triangle from polygon:var polygon = L.polygon([ [parseFloat(decimal_lat),parseFloat(decimal_lon)], [parseFloat(decimal_lat) + 1,...

View Article


Answer by dooderson for rotate polygon around point in leaflet map

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...

View Article


Answer by jbdev for rotate polygon around point in leaflet map

You can approach it a couple ways. Here is one...FIRST: calculate the bearing and distance to the two 'outer' points from the anchor point. Here are a couple helper...

View Article

Answer by Nikolay Pavlin for rotate polygon around point in leaflet map

I adapted @dooderson and @MBo from this question answers, the final code is something like this, it works perfectly!rotatePoints (center, points, yaw) { const res = [] const centerPoint =...

View Article
Browsing index pages (4 articles)


Latest Images