Rogue: Savage Rats, a retro-themed dungeon crawler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
rogue-savage-rats/src/mightypork/utils/math/rect/RectMath.java

111 lines
1.6 KiB

package mightypork.utils.math.rect;
import mightypork.utils.math.coord.Vec;
/**
* Operations available in rects
*
* @author MightyPork
*/
interface RectMath<T extends Rect> extends Rect {
/**
* Add vector to origin
*
* @param move offset vector
* @return result
*/
T move(Vec move);
/**
* Add X and Y to origin
*
* @param x x to add
* @param y y to add
* @return result
*/
T move(double x, double y);
/**
* Shrink to sides
*
* @param shrink shrink size (horisontal and vertical)
* @return result
*/
T shrink(Vec shrink);
/**
* Shrink to sides at sides
*
* @param x horizontal shrink
* @param y vertical shrink
* @return result
*/
T shrink(double x, double y);
/**
* Shrink the rect
*
* @param left shrink
* @param top shrink
* @param right shrink
* @param bottom shrink
* @return result
*/
T shrink(double left, double top, double right, double bottom);
/**
* Grow to sides
*
* @param grow grow size (added to each side)
* @return grown copy
*/
T grow(Vec grow);
/**
* Grow to sides
*
* @param x horizontal grow
* @param y vertical grow
* @return result
*/
T grow(double x, double y);
/**
* Grow the rect
*
* @param left growth
* @param top growth
* @param right growth
* @param bottom growth
* @return result
*/
T grow(double left, double top, double right, double bottom);
/**
* Check if point is inside this rectangle
*
* @param point point to test
* @return is inside
*/
boolean contains(Vec point);
/**
* Round coords
*
* @return result
*/
T round();
}