I want to find the point in between four points or not. Please help me, is there any algorithm?? I want to write in java program.
Thanks, Nitin
I want to find the point in between four points or not. Please help me, is there any algorithm?? I want to write in java program.
Thanks, Nitin
Lets say you have a rectangle called r, this r has an x position, y position, width and height.
The middle would be :
Point p = new Point(r.x + (r.width / 2), r.y + (r.height / 2));
To check if the point is inside the rectangle
if(p.x >= r.x && p.y >= r.y && p.x <= r.x + r.width && p.y <= r.y + r.height){
//The point is inside the rectangle
}
To check if the point is inside the four points if the points where layed out like this :
A B
C D
if(p.x >= a.x && p.y >= a.y && p.x <= b.x && p.y <= d.y){
//The point is inside the points
}