zerk.helper Class
Helper
Global helper function library.
Item Index
Methods
calculateDistance
(
Float
-
x1
-
y1
-
x2
-
y2
Calculates the distance between two positions
Parameters:
-
x1
FloatFirst horizontal position
-
y1
FloatFirst vertical position
-
x2
FloatSecond horizontal position
-
y2
FloatSecond vertical position
Returns:
Float:
The distance
formatPercent
(
String
-
value
Formats a number in percent notation
Parameters:
-
value
Float
Returns:
String:
Percent notated number
fromMeter
(
Float
-
value
Converts meters into pixels
Parameters:
-
value
FloatValue in meters
Returns:
Float:
Value in pixels
getCenterOfPolygon
(
Object
-
polygon
Returns the center position of given polygon
Parameters:
-
polygon
ArrayPolygon array
Returns:
Object:
Returns an object containing x and y position
isPolygonClockwise
(
Integer
-
polygon
Checks the clockwise order status of a polygon
Its assumed that:
- the polygon is closed
- the last point is not repeated
- the polygon is convex
Parameters:
-
polygon
ArrayPolygon array
Returns:
Integer:
Returns the following values:
0 = incomputable
1 = clockwise
-1 = counterclockwise
random
(
Float
-
min
-
max
Returns a random number between min and max
Parameters:
-
min
FloatMinimum
-
max
FloatMaximum
Returns:
Float:
Random number between min and max
rotatePosition
(
Object
-
x
-
y
-
angle
Rotate position at given angle
Parameters:
-
x
FloatHorizontal position
-
y
FloatVertical position
-
angle
FloatAngle
Returns:
Object:
Returns an object containing x and y position
round
(
Float
-
value
-
decimals
Rounds a number to given decimals
Parameters:
-
value
FloatNumber
-
decimals
IntegerNumber of decimals
Returns:
Float:
Rounded number
toMeter
(
Float
-
value
Converts pixels into meters
Parameters:
-
value
FloatValue in pixels
Returns:
Float:
Value in meters