Package de.xima.fc.common.geometry
Class Rectangle2DDouble
- java.lang.Object
-
- de.xima.fc.common.geometry.Rectangle2DDouble
-
public final class Rectangle2DDouble extends Object
A 2-dimensional rectangle with double precision.- Since:
- 8.4.0
-
-
Constructor Summary
Constructors Constructor Description Rectangle2DDouble(double x, double y, double width, double height)
Creates a rectangle with the specified position and size.Rectangle2DDouble(Point2DDouble position, Rectangular2DDouble size)
Creates a rectangle with the specified position and size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
heightDouble()
Returns the height of the rectangle.Point2DDouble
position()
Returns the position of the rectangle, i.e.Rectangular2DDouble
size()
Returns the size of the rectangle.Rectangle2DDouble
translate(double deltaX, double deltaY)
Translates the rectangle by the specified amounts in the x and y directions.double
widthDouble()
Returns the width of the rectangle.double
x1Double()
Returns the x coordinate of the left edge of the rectangle.double
x2Double()
Returns the x coordinate of the right edge of the rectangle.double
xDouble()
Returns the x coordinate of the left edge of the rectangle.double
y1Double()
Returns the y coordinate of the top edge corner of the rectangle.double
y2Double()
Returns the y coordinate of the bottom edge corner of the rectangle.double
yDouble()
Returns the y coordinate of the top edge corner of the rectangle.
-
-
-
Constructor Detail
-
Rectangle2DDouble
public Rectangle2DDouble(double x, double y, double width, double height)
Creates a rectangle with the specified position and size.- Parameters:
x
- The x-coordinate of the top-left corner of the rectangle.y
- The y-coordinate of the top-left corner of the rectangle.width
- The width of the rectangle.height
- The height of the rectangle.
-
Rectangle2DDouble
public Rectangle2DDouble(Point2DDouble position, Rectangular2DDouble size)
Creates a rectangle with the specified position and size.- Parameters:
position
- The position of the top-left corner of the rectangle.size
- The size of the rectangle.
-
-
Method Detail
-
heightDouble
public double heightDouble()
Returns the height of the rectangle.- Returns:
- The height of the rectangle.
-
position
public Point2DDouble position()
Returns the position of the rectangle, i.e. the coordinates of its top-left corner.- Returns:
- The position of the rectangle.
-
size
public Rectangular2DDouble size()
Returns the size of the rectangle.- Returns:
- The size of the rectangle.
-
translate
public Rectangle2DDouble translate(double deltaX, double deltaY)
Translates the rectangle by the specified amounts in the x and y directions.- Parameters:
deltaX
- The amount to translate the rectangle in the x direction.deltaY
- The amount to translate the rectangle in the y direction.- Returns:
- A rectangle that is translated by the specified amounts.
-
widthDouble
public double widthDouble()
Returns the width of the rectangle.- Returns:
- The width of the rectangle.
-
x1Double
public double x1Double()
Returns the x coordinate of the left edge of the rectangle.- Returns:
- The x coordinate of the left edge of the rectangle.
-
x2Double
public double x2Double()
Returns the x coordinate of the right edge of the rectangle.- Returns:
- The x coordinate of the right edge of the rectangle.
-
xDouble
public double xDouble()
Returns the x coordinate of the left edge of the rectangle.- Returns:
- The x coordinate of the left edge of the rectangle.
-
y1Double
public double y1Double()
Returns the y coordinate of the top edge corner of the rectangle.- Returns:
- The y coordinate of the top edge corner of the rectangle.
-
y2Double
public double y2Double()
Returns the y coordinate of the bottom edge corner of the rectangle.- Returns:
- The y coordinate of the bottom edge corner of the rectangle.
-
yDouble
public double yDouble()
Returns the y coordinate of the top edge corner of the rectangle.- Returns:
- The y coordinate of the top edge corner of the rectangle.
-
-