Arma Reforger Script API
|
SCR_Math2D Class. More...
Static Public Member Functions | |
static void | Get2DPolygon (notnull array< vector > points3D, out notnull array< float > points2D) |
Get 2D points array from vector array, format { x1,y1, x2,y2, x3,y3 }. | |
static void | Get3DPolygon (notnull array< float > points2D, out notnull array< vector > points3D) |
Get an array of vectors from 2D array with 0 for Y value. | |
static bool | GetMinMaxPolygon (notnull array< float > polygon, out float minX, out float maxX, out float minY, out float maxY) |
static float | GetPolygonArea (notnull array< float > polygon) |
Get provided polygon's area. | |
static bool | GetRandomPointInPolygon (notnull array< float > polygon, out float x, out float y) |
Get a random point within the provided 2D polygon. | |
static bool | GetRandomPointInRectangle (float minX, float maxX, float minY, float maxY, out float x, out float y) |
Get a random point in the provided rectangle. | |
static bool | GetRandomPointInSector (float originX, float originY, float angleFrom, float angleTo, float radius, out float x, out float y) |
Get a random point in the provided circular sector - uniform distribution. | |
static bool | IsPolygonValid (notnull array< float > polygon) |
Checks the amount of points for a 2D polygon (needs 3 points to make a polygon and an even amount of values to have valid points) | |
static bool | PolarToCartesian (float angle, float radius, out float x, out float y) |
Translates polar coordinates (angle and radius) into cartesian (x,y) | |
static float | DegreeToTrigoRadian (float value) |
Get a counter-clockwise radian angle value from clockwise angles. | |
static bool | GetLinesIntersectionXZ (float x0, float y0, float angleRad0, float x1, float y1, float angleRad1, out float x, out float y) |
static vector | GenerateRandomPoint (array< float > polygon, vector bbMin, vector bbMax) |
Generates random point in given polygon. | |
static vector | GenerateRandomPointInRadius (float minRadius, float maxRadius, vector center, bool uniform=true) |
Generates a random point around center in range min/max radius. | |
Static Protected Member Functions | |
static bool | CartesianToPolar (float x, float y, out float angle, out float radius) |
Translates cartesian coordinates (x,y) into polar (angle and radius) | |
SCR_Math2D Class.
Contains various scripted 2D math functions
|
staticprotected |
Translates cartesian coordinates (x,y) into polar (angle and radius)
[in] | x | |
[in] | y | |
[out] | angle | in radian |
[out] | radius |
|
static |
Get a counter-clockwise radian angle value from clockwise angles.
[in] | value | angle in clockwise degrees |
|
static |
Generates random point in given polygon.
[in] | polygon | Consecutive floats give polygon in 2D (2 floats = Vector2) |
[in] | bbMin | Bounding box minimum corner |
[in] | bbMax | Bounding box maximum corner |
|
static |
Generates a random point around center
in range min/max radius.
[in] | minRadius | All generated points will be at least this far from center |
[in] | maxRadius | All generated points will be at most this far from center |
[in] | center | Position around which to generate. Vector2 XZ |
[in] | uniform | If false, has a small bias towards the center which may be desirable in some situations |
|
static |
Get 2D points array from vector array, format { x1,y1, x2,y2, x3,y3 }.
[in] | points3D | |
[out] | points2D |
|
static |
Get an array of vectors from 2D array with 0 for Y value.
[in] | points2D | |
[out] | points3D |
|
static |
[in] | x0 | |
[in] | y0 | |
[in] | angleRad0 | counter-clockwise radians, range does not matter (no need for [0..Math.PI2[) |
[in] | x1 | |
[in] | y1 | |
[in] | angleRad1 | counter-clockwise radians, range does not matter (no need for [0..Math.PI2[) |
[out] | x | |
[out] | y |
|
static |
[in] | polygon | |
[out] | minX | |
[out] | maxX | |
[out] | minY | |
[out] | maxY |
|
static |
Get provided polygon's area.
[in] | polygon |
|
static |
Get a random point within the provided 2D polygon.
[in] | polygon | |
[out] | x | found point's x coordinates |
[out] | y | found point's x coordinates |
|
static |
Get a random point in the provided rectangle.
[in] | minX | |
[in] | maxX | |
[in] | minY | |
[in] | maxY | |
[out] | x | |
[out] | y |
|
static |
Get a random point in the provided circular sector - uniform distribution.
[in] | originX | |
[in] | originY | |
[in] | angleFrom | angle in radians from which we calculate random angle |
[in] | angleTo | angle in radians to which we calculate random angle |
[in] | radius | |
[out] | x | |
[out] | y |
|
static |
Checks the amount of points for a 2D polygon (needs 3 points to make a polygon and an even amount of values to have valid points)
[in] | polygon | format x0, y0, x1, y1 etc |
|
static |
Translates polar coordinates (angle and radius) into cartesian (x,y)
[in] | angle | in radians |
[in] | radius | |
[out] | x | |
[out] | y |