var d = require('euclidean-distance');
 
// d([0,0], [1,0]);
// // 1 
 
// d([0,0], [3,2]);
// 3.605551275463989 
 


// console.log(d([-7,-4,3], [17, 6, 2.5]));

// 26.004807247892 

// // This should be able to take any number of coordinate sets
// function point(array1, array2) {
// 	var midpoint;
// 	var x;
// 	var y;

// 	// Add X
// 	x = array1[0] + array2[0];

// 	// Add Y
// 	y = array1[1] + array2[1];

// 	midpoint = [x * .5, y * .5];

// 	return midpoint;
// }


// This should be able to take any number of coordinate sets
function point(arrays) {
	var midpoint;
	var x = 0; // Getting there, but we need to be able to be able to have any number of dimesions..
	var y = 0;
	var z = 0;

	for (var i = 0; i < arrays.length; i++) {
		x =	arrays[i][0] + x;
		y =	arrays[i][1] + y;

		z =	arrays[i][2] + z;
	};

	midpoint = [x * .5, y * .5, z * .5];

	return midpoint;
}

var euclideanDistance = (d([-3,4,1], [2,1,1]));
var euclideanMidpoint = point([[1,4,3], [3,-2,3]]);

console.log('euclideanDistance: ' + euclideanDistance);
console.log('euclideanMidpoint: ' + euclideanMidpoint);

