package com.cringe_studios.christmastreescanning.scanning;

import java.awt.geom.Point2D;

public class PointInterpolator {
	Point2D points[];
	
	public PointInterpolator(Point2D...na) {
		points = na;
	}
	
	public Point2D getCenter() {
		double xSum = 0;
		double ySum = 0;
		
		for(int i = 0; i < points.length; i++) {
			xSum += points[i].getX();
			ySum += points[i].getY();
		}
		
		//https://math.stackexchange.com/questions/1599095/how-to-find-the-equidistant-middle-point-for-3-points-on-an-arbitrary-polygon
		return new Point2D.Double( xSum / points.length, ySum / points.length);
	}
}
