Last active
November 21, 2019 04:57
-
-
Save davidcalhoun/d3416a79c2b8a342e63b9a0b47371300 to your computer and use it in GitHub Desktop.
Revisions
-
davidcalhoun revised this gist
Nov 21, 2019 . 1 changed file with 11 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,20 +13,27 @@ const getXY = (azim, elev, canvasSize) => { const opp = toFixedFloat(Math.sin(angle) * hyp, 2); const adj = toFixedFloat(Math.cos(angle) * hyp, 2); // return x, y coords in the orientation of compass directions. // 0 = N, 90 = E, 180 = S, 270 = W // need to do some basic coord transforms because the triangle math won't work without 90 deg // triangles (degress 0-90 only), also to account for compass directions, which are rotated and // flipped, as opposed to standard math orientation if (azim >= 0 && azim < 90) { return [opp, adj]; } if (azim >= 90 && azim < 180) { return [adj, -opp]; } if (azim >= 180 && azim < 270) { return [-opp, -adj]; } if (azim >= 270 && azim < 360) { return [-adj, opp]; } return [0, 0] -
davidcalhoun revised this gist
Nov 21, 2019 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,17 @@ const elevToHypLength = (elev, canvasSize) => { return canvasSize - (canvasSize * elev) / 89.99999999; } const deg2rad = deg => (Math.PI * 2 * deg) / 360; const toFixedFloat = (num = 0, digitsAfterDecimal = 0) => parseFloat(num.toFixed(digitsAfterDecimal)) const getXY = (azim, elev, canvasSize) => { const hyp = elevToHypLength(elev, canvasSize / 2); const angle = deg2rad(azim % 90); const opp = toFixedFloat(Math.sin(angle) * hyp, 2); const adj = toFixedFloat(Math.cos(angle) * hyp, 2); if (azim >= 0 && azim < 90) { return [adj, opp]; -
davidcalhoun revised this gist
Nov 21, 2019 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,19 +11,19 @@ const getXY = (azim, elev, canvasSize) => { const opp = Math.sin(angleRads) * hyp; const adj = Math.cos(angleRads) * hyp; if (azim >= 0 && azim < 90) { return [adj, opp]; } if (azim >= 90 && azim < 180) { return [-opp, adj]; } if (azim >= 180 && azim < 270) { return [-adj, -opp]; } if (azim >= 270 && azim < 360) { return [opp, -adj]; } -
davidcalhoun revised this gist
Nov 21, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,10 +6,10 @@ const deg2rad = deg => (Math.PI * 2 * deg) / 360; const getXY = (azim, elev, canvasSize) => { const hyp = elevToHypLength(elev, canvasSize / 2); const angleRads = deg2rad(azim % 90); const opp = Math.sin(angleRads) * hyp; const adj = Math.cos(angleRads) * hyp; if (azim >= 0 && azim <= 89.9999999) { return [adj, opp]; -
davidcalhoun revised this gist
Nov 21, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ const elevToHypLength = (elev, max) => { return max - (max * elev) / 89.99999999; } const deg2rad = deg => (Math.PI * 2 * deg) / 360; -
davidcalhoun renamed this gist
Nov 21, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
davidcalhoun created this gist
Nov 21, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ const elevToHypLength = (elev, canvasSize) => { return canvasSize - (canvasSize * elev) / 89.99999999; } const deg2rad = deg => (Math.PI * 2 * deg) / 360; const getXY = (azim, elev, canvasSize) => { const hyp = elevToHypLength(elev, canvasSize / 2); const angle = deg2rad(azim % 90); const opp = Math.sin(angle) * hyp; const adj = Math.cos(angle) * hyp; if (azim >= 0 && azim <= 89.9999999) { return [adj, opp]; } if (azim >= 90 && azim <= 179.9999999) { return [-opp, adj]; } if (azim >= 180 && azim <= 269.9999999) { return [-adj, -opp]; } if (azim >= 270 && azim <= 359.9999999) { return [opp, -adj]; } return [0, 0] }