- java.lang.Object
-
- org.jgrapht.alg.drawing.model.Box2D
-
- All Implemented Interfaces:
java.io.Serializable
public class Box2D extends java.lang.Object implements java.io.Serializable
A 2-dimensional box (rectangle).- Author:
- Dimitrios Michail
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected double[]
coordinates
The coordinates of the lower cornerprotected double[]
sides
The side lengths
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
double
getHeight()
Get the heightdouble
getMaxX()
Get the maximum x coordinatedouble
getMaxY()
Get the maximum y coordinatedouble
getMinX()
Get the minimum x coordinatedouble
getMinY()
Get the minimum y coordinatedouble
getWidth()
Get the widthint
hashCode()
static Box2D
of(double width, double height)
Create a new boxstatic Box2D
of(double x, double y, double width, double height)
Create a new boxjava.lang.String
toString()
-
-
-
Constructor Detail
-
Box2D
public Box2D(double width, double height)
Create a new box- Parameters:
width
- the widthheight
- the height
-
Box2D
public Box2D(double x, double y, double width, double height)
Create a new box- Parameters:
x
- the x coordinate of the lower-left cornery
- the y coordinate of the lower-left cornerwidth
- the widthheight
- the height
-
Box2D
public Box2D(double[] coordinates, double[] sides)
Create a new box- Parameters:
coordinates
- the lower left corner coordinatessides
- width and height
-
-
Method Detail
-
getMinX
public double getMinX()
Get the minimum x coordinate- Returns:
- the minimum x coordinate
-
getMinY
public double getMinY()
Get the minimum y coordinate- Returns:
- the minimum y coordinate
-
getWidth
public double getWidth()
Get the width- Returns:
- the width
-
getHeight
public double getHeight()
Get the height- Returns:
- the height
-
getMaxX
public double getMaxX()
Get the maximum x coordinate- Returns:
- the maximum x coordinate
-
getMaxY
public double getMaxY()
Get the maximum y coordinate- Returns:
- the maximum y coordinate
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
of
public static Box2D of(double width, double height)
Create a new box- Parameters:
width
- the widthheight
- the height- Returns:
- the box
-
of
public static Box2D of(double x, double y, double width, double height)
Create a new box- Parameters:
x
- the x coordinate of the lower-left cornery
- the y coordinate of the lower-left cornerwidth
- the widthheight
- the height- Returns:
- the box
-
-