BIS fnc randomPosIntersection: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (infobox to template)
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *S([a-z ])" to "$1 - s$2")
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function


| arma3 |Game name=
|game1= arma3
|version1= 1.82


|1.82|Game version=
|gr1= Positions


<!---|arg= local |Multiplayer Arguments=--->
|gr2= Geometry


<!---|eff= local |Multiplayer Effects=--->
|descr= Returns random 2D position inside the intersection of two circles. [-1,-1] is returned if the circles do not intersect.


| <pre>/*
|s1= [firstCircle, secondCircle, positioning1, positioning2] call [[BIS_fnc_randomPosIntersection]]
Author: Riccardo Argiolas


Description:
|p1= firstCircle: [[Object]], [[String]] or [[Array]] - first circle. Can be a trigger, a marker or an array in form
Returns random 2D position inside the intersection of two circles. [-1,-1] is returned if the circles do not intersect.
*0: [[Array]] - circleCenter
**0: [[Number]] - coordinate X
**1: [[Number]] - coordinate Y
*1: [[Number]] - radius


Parameters:
|p2= secondCircle: [[Object]], [[String]] or [[Array]] - second circle. Same as above.
Select 0 - OBJECT/STRING/ARRAY : First circle. Can be a trigger, a marker or an array of [circleCenter, radius], where circleCenter is [xCenterPosition, yCenterPosition]
Select 1 - OBJECT/STRING/ARRAY : Second circle. Same as above.
Select 2 - NUMBER : If a value between 0 and 1 is passed (0 and 1 included), then a gaussian distribution is used. This will influence the random position along the axis which connects the two circles' centers. A lower value means the position will be close to the first circle.
Select 3 - NUMBER : If a value between 0 and 1 is passed (0 and 1 included), then a gaussian distribution is used. This will influence the random position along the axis perpendicular to the axis which connects the two circles' centers.
Returns:
ARRAY : 2D Position in [x,y] format
*/</pre>{{placeholder}}<!-- Remove this after fill-in --> |Description=


|[] call [[BIS_fnc_randomPosIntersection]]|Syntax=
|p3= positioning1: [[Number]] - (Optional, default -1) if a value between 0 and 1 is passed (0 and 1 included), then a gaussian distribution is used. This will influence the random position along the axis which connects the two circles' centers. A lower value means the position will be close to the first circle


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
|p4= positioning2: [[Number]] - (Optional, default -1) if a value between 0 and 1 is passed (0 and 1 included), then a gaussian distribution is used. This will influence the random position along the axis perpendicular to the axis which connects the two circles' centers


|Datatype - description|Return value=
|r1= [[Array]] - 2D Position


|x1= <code></code>|Example 1=
|x1= <sqf>[trigger1, trigger2, 0.75, 0.75] call BIS_fnc_randomPosIntersection;</sqf>


|exec= call |Execution=
|seealso=
 
| |See also=
}}
}}
[[Category:Function Group: Map|{{uc:randomPosIntersection}}]]
[[Category:Functions|{{uc:randomPosIntersection}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:randomPosIntersection}}]]

Latest revision as of 16:49, 8 November 2023

Hover & click on the images for description

Description

Description:
Returns random 2D position inside the intersection of two circles. [-1,-1] is returned if the circles do not intersect.
Execution:
call
Groups:
PositionsGeometry

Syntax

Syntax:
[firstCircle, secondCircle, positioning1, positioning2] call BIS_fnc_randomPosIntersection
Parameters:
firstCircle: Object, String or Array - first circle. Can be a trigger, a marker or an array in form
secondCircle: Object, String or Array - second circle. Same as above.
positioning1: Number - (Optional, default -1) if a value between 0 and 1 is passed (0 and 1 included), then a gaussian distribution is used. This will influence the random position along the axis which connects the two circles' centers. A lower value means the position will be close to the first circle
positioning2: Number - (Optional, default -1) if a value between 0 and 1 is passed (0 and 1 included), then a gaussian distribution is used. This will influence the random position along the axis perpendicular to the axis which connects the two circles' centers
Return Value:
Array - 2D Position

Examples

Example 1:
[trigger1, trigger2, 0.75, 0.75] call BIS_fnc_randomPosIntersection;

Additional Information

See also:
See also needed

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note