Skip to content

Instantly share code, notes, and snippets.

@drnic
Created June 17, 2018 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drnic/e4184420833391741cbb5286c3713205 to your computer and use it in GitHub Desktop.
Save drnic/e4184420833391741cbb5286c3713205 to your computer and use it in GitHub Desktop.
var martinez = require('martinez-polygon-clipping');
// https://skyvector.com/?fpl=3529S14100E%203556S14216E%203557S14217E%203558S14222E%203650S14259E%203658S14256E%203730S14251E%203720S14319E%203714S14356E%203705S14444E%203712S14510E%203627S14548E%203559S14623E%203553S14610E%203544S14547E%203535S14525E%203526S14502E%203516S14440E%203507S14417E%203458S14355E%203448S14333E%203438S14311E%203429S14249E%203419S14227E%203409S14205E%203359S14143E%203349S14122E%203339S14100E%203529S14100E
var big = [ [ 141, -35.49 ],
[ 142.27, -35.93 ],
[ 142.28, -35.95 ],
[ 142.37, -35.97 ],
[ 142.98, -36.83 ],
[ 142.93, -36.97 ],
[ 142.85, -37.5 ],
[ 143.32, -37.33 ],
[ 143.93, -37.23 ],
[ 144.73, -37.08 ],
[ 145.17, -37.2 ],
[ 145.8, -36.45 ],
[ 146.39, -35.98 ],
[ 146.16, -35.89 ],
[ 145.79, -35.74 ],
[ 145.41, -35.59 ],
[ 145.03, -35.43 ],
[ 144.66, -35.27 ],
[ 144.29, -35.12 ],
[ 143.92, -34.96 ],
[ 143.55, -34.8 ],
[ 143.18, -34.64 ],
[ 142.81, -34.48 ],
[ 142.45, -34.31 ],
[ 142.08, -34.15 ],
[ 141.72, -33.98 ],
[ 141.36, -33.82 ],
[ 141, -33.65 ],
[ 141, -35.49 ] ]
// https://skyvector.com/?fpl=3800S14230E%203800S14300E%203730S14300E%203730S14230E%203800S14230E
var small =
[ [ 142.5, -38 ],
[ 143, -38 ],
[ 143, -37.5 ],
[ 142.5, -37.5 ],
[ 142.5, -38 ] ];
console.log(martinez.intersection([big], [small]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment