MIST getRandPointInCircle
From DCS World Wiki - Hoggitworld.com
mist.getRandPointInCircle
Added with: Mist 2.0 |
Description |
Returns a randomly generated vec2 coordinate within the specified radius around the center of vec 2 or vec3 point given. If the optional variable innerRadius is given the random point will be generated that has a minimum distance of innerRadius and a maximum distance of radius from the point.
The optional values maxA and minA can be used to limit the possible area of a circle that the random point is returned within. Think of a pizza slice or Pacman as the shape that can be returned. maxA and minA are defined in degrees. maxA is optional. If not present then it assumes the shape is a circle. minA is optional. If not present then the range will assume minA is 0 (North) to whatever maxA is set to if present. |
Syntax |
vec2 mist.getRandPointInCircle(table vec2/vec3 ,number radius , number innerRadius ,number maxA ,number minA ) |
Valid Input Values: |
vec2/vec3 = valid vec2/3 table
radius = any positive number innerRadius = any positive number less than radius |
Return value: |
vec2 |
Return example: |
Template:Vec2 |
Usage Examples: |
The following code will deploy a smoke marker randomly inside a zone.
end
local u = Unit.getByName('whatever') local headingDeg = math.deg(mist.getHeading(u, true)) local newPoint = mist.getRandPointInCircle(u:getPoint(), 20000, 10000, headingDeg + 90, headingDeg - 90) |
Notes: |
Used within: groupToRandomZone, groupRandomDistSelf, groupToRandomPoint |
Related Functions |
makeUnitTable, getRandPointInCircle, getRandomPointInZone, getRandomPointInPoly, isTerrainValid, terrainHeightDiff, getUnitsInZones, getUnitsInMovingZones, pointInPolygon, getUnitsInPolygon, getDeadMapObjsInZones, getDeadMapObjsInPolygonZone, getUnitsLOS, random, randomizeNumTable, getAvgPoint, getQFE, getWindBearingAndVel, getPathLength, getPathInSegments, getPointAtDistanceOnPath, projectPoint, getGroupsByAttribute, , getUnitsByAttribute, mapValue, |