Skip to content

Instantly share code, notes, and snippets.

@LucasIron
Created August 1, 2018 21:49
Show Gist options
  • Select an option

  • Save LucasIron/a5cb25e5c0417567d717374a82c515ca to your computer and use it in GitHub Desktop.

Select an option

Save LucasIron/a5cb25e5c0417567d717374a82c515ca to your computer and use it in GitHub Desktop.
Overlap for N dimensions function
const overlap = baseLines => comparisonLines => baseLines.reduce((bool, baseLine, index) => {
const comparisonLine = comparisonLines[index];
if (bool === true) return Math.max(baseLine[0], comparisonLine[0]) < Math.min(baseLine[1], comparisonLine[1]);
else return false;
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment