package Objects;

//import java.awt.Point;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import java.util.Vector;

public class DetectionLine {

	private Vector<Point> linePoints = new Vector<>();

	public void addPoint(Point p) {
		linePoints.add(p);
	}

	public boolean crossLine(Rect rect) {
		Point p = new Point(rect.x + rect.width/2, rect.y + rect.height/2);
		if (comparePoint(p)) {
			// linku pretal v bode x,y
			return true;
		}
		return false;
	}

	private boolean comparePoint(Point p) {
		for (Point point : linePoints) {
			if (p.x == point.x && p.y == point.y) {
				return true;
			}
		}
		return false;
	}
	
	public Vector<Point> getPoints()
	{
		return linePoints;	
	}
	
	public int getSize()
	{
		return linePoints.size();
		
	}

}
