midpoint

find the midpoint of a line

Usage no npm install needed!

<script type="module">
  import midpoint from 'https://cdn.skypack.dev/midpoint';
</script>

README

MidPoint

Find the midpoint of a line.

npm install midpoint

to use

midPoint([[0,0], [1,1], [2,2]]);// -> returns [1, 1]
midPoint([[0,0], [1,1], [2,2], [3,3]]);// -> returns [1.5, 1.5]
midPoint([[0,0], [1,1], [3,3]]);// -> returns [1.5, 1.5]