class Util
package geometrize
Utility functions.
Static methods
staticinline abs (value:Int):Int
Returns the absolute value of the given value.
Parameters:
value | The value to abs. |
---|
Returns:
The absolute value of the given value.
staticinline clamp (value:Int, min:Int, max:Int):Int
Clamps a value within a range.
Parameters:
value | The value to clamp. |
---|---|
min | The lower bound of the range. |
max | The upper bound of the range. |
Returns:
The clamped value.
staticgetAverageImageColor (image:Bitmap, alpha:Int = 255):Rgba
Computes the average RGB color of the pixels in the image.
Parameters:
image | The image whose average color will be calculated. |
---|---|
alpha | The opacity of the image (0-255), defaults to opaque (255). |
Returns:
The average RGB color of the image, RGBA8888 format. Alpha defaults to opaque (255).
staticinline max (first:Int, second:Int):Int
Compare two values and returns the larger one.
Parameters:
first | The first value. |
---|---|
second | The second value. |
Returns:
The larger value.
staticinline min (first:Int, second:Int):Int
Compares two values and returns the smaller one.
Parameters:
first | The first value. |
---|---|
second | The second value. |
Returns:
The smaller value.
staticinline minMaxElements (a:Array<Int>):Point
Returns the smallest and largest items from an array of ints.
Parameters:
a | The array of ints. |
---|
Returns:
The smallest and largest items from the array.
staticinline random (lower:Int, upper:Int):Int
Returns a random integer in the range (inclusive).
Parameters:
lower | The lower bound. |
---|---|
upper | The upper bound. |
Returns:
A random integer in the range [lower:upper] inclusive.
staticinline randomArrayItem<T> (a:Array<T>):T
Returns a random item from an array.
Parameters:
a | The array to pick a random item from. |
---|
Returns:
A random item from the array.
staticinline toDegrees (radians:Float):Float
Converts a value measured in radians to degrees.
Parameters:
radians | Radians value to convert to degrees. |
---|
Returns:
The value converted to degrees.
staticinline toRadians (degrees:Float):Float
Converts a value measured in degrees to radians.
Parameters:
degrees | Degrees value to convert to radians. |
---|
Returns:
The value converted to radians.