public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
ceil(double x)
A fast implementation of
Math.ceil(double). |
static double |
clamp(double value,
double min,
double max)
Clamp the value into the range [min..max].
|
static Rectangle2D |
dilateRect(Rectangle2D r,
double marginX,
double marginY)
Return a new rectangle which covers the area of the given rectangle with an additional margin on the sides.
|
static Rectangle |
enlargeRectToGrid(Rectangle2D r)
Create a rectangle with the same area as the given input rectangle but with all of its edges snapped (rounded) to
the integer grid.
|
static int |
floor(double x)
A fast implementation of
Math.floor(double). |
static int |
round(double x)
A fast implementation of
Math.round(double). |
public static Rectangle enlargeRectToGrid(Rectangle2D r)
enlargeToGrid(r).contains(r) == true holds. This can be depicted as the edges being stretched
in an outward direction.r - the given rectanglepublic static Rectangle2D dilateRect(Rectangle2D r, double marginX, double marginY)
r - the given rectanglemarginX - horizontal value of the additional marginmarginY - vertical value of the additional marginpublic static double clamp(double value,
double min,
double max)
value - input valuemin - minimal valuemax - maximal valuepublic static int floor(double x)
Math.floor(double).x - the argumentpublic static int round(double x)
Math.round(double).x - the argumentpublic static int ceil(double x)
Math.ceil(double).x - the argumentCopyright © 2022 The Apache Software Foundation. All rights reserved.