solution 1 in exercises in chapter 6
hey guys i can't understand this particular code:
class Rectangle extends Shape{
public Rectangle(Point startDiag, Point endDiag) {
// Bottom right is relative to top left:
bottomRight = new Point(Math.max(startDiag.x,endDiag.x)  position.x, Math.max(startDiag.y,endDiag.y)  position.y);
}
//rest of the code
}
in bottomRight why the new points need to be subtracted from postion.x and position.y? in comment is says "bottom right is relative to top left" i can't see it's relevance.
Where you can simply write it:
bottomRight = new Point(Math.max(startDiag.x,endDiag.x),
Math.max(startDiag.y,endDiag.y));
instead of:
bottomRight = new Point(Math.max(startDiag.x,endDiag.x)  position.x,
Math.max(startDiag.y,endDiag.y)  position.y);
thank guys i will really appreciate your help.
