Skip to content

Commit

Permalink
fix: Reverse rotation factor for KML GroundOverlay
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Aug 11, 2023
1 parent 71ce365 commit b89fbe4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
48 changes: 24 additions & 24 deletions lib/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12996,24 +12996,24 @@ exports[`toGeoJSON > ground_overlay.kml 1`] = `
"coordinates": [
[
[
14.600668902543442,
37.91801270483731,
],
[
15.35770894852841,
14.60190128636069,
37.92006947469352,
],
[
15.358941332345658,
37.466463107960706,
37.91801270483731,
],
[
14.60190128636069,
15.35770894852841,
37.464406338104496,
],
[
14.600668902543442,
37.91801270483731,
37.466463107960706,
],
[
14.60190128636069,
37.92006947469352,
],
],
],
Expand Down Expand Up @@ -13049,24 +13049,24 @@ exports[`toGeoJSON > ground_overlay.kml 2`] = `
"coordinates": [
[
[
14.600668902543442,
37.91801270483731,
],
[
15.35770894852841,
14.60190128636069,
37.92006947469352,
],
[
15.358941332345658,
37.466463107960706,
37.91801270483731,
],
[
14.60190128636069,
15.35770894852841,
37.464406338104496,
],
[
14.600668902543442,
37.91801270483731,
37.466463107960706,
],
[
14.60190128636069,
37.92006947469352,
],
],
],
Expand Down Expand Up @@ -13109,24 +13109,24 @@ exports[`toGeoJSON > ground_overlay.kml 3`] = `
"coordinates": [
[
[
14.600668902543442,
37.91801270483731,
],
[
15.35770894852841,
14.60190128636069,
37.92006947469352,
],
[
15.358941332345658,
37.466463107960706,
37.91801270483731,
],
[
14.60190128636069,
15.35770894852841,
37.464406338104496,
],
[
14.600668902543442,
37.91801270483731,
37.466463107960706,
],
[
14.60190128636069,
37.92006947469352,
],
],
],
Expand Down
2 changes: 1 addition & 1 deletion lib/kml/ground_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function rotateBox(
const dy = coordinate[1] - center[1];
const dx = coordinate[0] - center[0];
const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2));
const angle = Math.atan2(dy, dx) - rotation * DEGREES_TO_RADIANS;
const angle = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;

return [
center[0] + Math.cos(angle) * distance,
Expand Down

0 comments on commit b89fbe4

Please sign in to comment.