Croping out points from an array list in Java -
crop: has parameters 2 points in cloud. 1 of these 2 points bottom corner, , other diagonally across top corner of rectangle. crop remove points outside rectangle cloud crop image. crop method must deal 2 input points on horizontal or vertical line segment, in case points not on line segment removed, , must deal 2 equal points p1 , p2, in case points p1 removed cloud. for example, if 2 input points (0.0,0,0) , (1.0,1.0), points outside square delimited (0.0,0.0), (0.0,1.0), (1.0,1.0), , (0.0,1.0) removed, if 2 input points (0.0,0,0) , (0.0,1.0), points outside line segment delimited (0.0,0.0), , (0.0,1.0) removed. i'm having hard time approaching logically. if me out thankful. public void crop(point p1, point p2) { point left = points.get(0); point right = points.get(1); point top = points.get(2); point bottom = points.get(3); // point []rectangle2d = {p1,p2}; rectangle2d rect = new rectangle2d.double(p1.getx(), p1.gety(), p2.getx(), p2