2 * Sixth 3D engine. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
5 package eu.svjatoslav.sixth.e3d.geometry;
7 import static java.lang.Math.abs;
8 import static java.lang.Math.min;
13 public class Rectangle {
15 public Point2D p1, p2;
17 public Rectangle(final double size) {
18 p2 = new Point2D(size / 2, size / 2);
19 p1 = p2.clone().invert();
22 public Rectangle(final Point2D p1, final Point2D p2) {
27 public double getHeight() {
28 return abs(p1.y - p2.y);
31 public double getLowerX() {
32 return min(p1.x, p2.x);
35 public double getLowerY() {
36 return min(p1.y, p2.y);
39 public double getWidth() {
40 return abs(p1.x - p2.x);