Add offset method to point

This commit is contained in:
ThatGamerBlue
2020-06-03 14:35:53 +01:00
parent 1868f69c42
commit b6256767cc

View File

@@ -45,4 +45,16 @@ public class Point
{
return (int) Math.hypot(getX() - other.getX(), getY() - other.getY());
}
/**
* Returns a new point offset by xOff and yOff
*
* @param xOff X offset to apply
* @param yOff Y offset to apply
* @return A new instance of Point, offset by x + xOff and y + yOff
*/
public Point offset(int xOff, int yOff)
{
return new Point(x + xOff, y + yOff);
}
}