package Objects;

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

public class DetectionArea {
	private HashSet<Point> points = new HashSet<>();

	public void addPoint(HashSet<Point> p) {
		points.addAll(p);
	}

	public boolean moveInArea(Rect rect) {
		Point p = new Point(rect.x + rect.width/2, rect.y + rect.height/2);
		for (Point point : points) {
			if (p.x == point.x && p.y == point.y) {
				return true;
			}
			// p.setLocation(rect.x + rect.getWidth, rect.y);
			/*p.x = rect.x + rect.width;
			p.y = rect.y;
			if (p.x == point.x && p.y == point.y) {
				return true;
			}
			// p.setLocation(rect.x, rect.y + rect.getHeight());
			p.x = rect.x;
			p.y = rect.y + rect.height;
			if (p.x == point.x && p.y == point.y) {
				return true;
			}
			// p.setLocation(rect.x + rect.getWidth(), rect.y +
			// rect.getHeight());
			p.x = rect.x + rect.width;
			p.y = rect.y + rect.height;
			if (p.x == point.x && p.y == point.y) {
				return true;
			}*/
		}
		return false;
	}
	  
}