Gen. MERICA 3 Posted May 4, 2017 I am having difficulty creating random positions inside of an ellipse. As for now I have a (what I think is funny) work around by just doing a circle, and then checking the inArea command for the ellipse. But does anyone know a quick equation to return a position inside of a rotated ellipse? Tried searching around but I must be missing a search term or something. Thanks Share this post Link to post Share on other sites
Larrow 2822 Posted May 4, 2017 I'm sure I've posted something similar in the forums before but I'm damned if I can find it. So.. //Create random elliptical marker _mrk = createMarker [ "myEllipticalMarker", getPos player ]; _mrk setMarkerShape "ELLIPSE"; _mrk setMarkerSize [ ( random 100 ) + 75, ( random 25 ) + 25 ]; _mrk setMarkerDir random 360; _mrk setMarkerBrush "Solid"; _mrk setMarkerColor "ColorBlack"; _mrk setMarkerAlpha 1; //Function to get random position in elliptical marker TAG_fnc_randomMarkerPos = { params[ "_mrk" ]; _pos = getMarkerPos _mrk; markerSize _mrk params[ "_axisA", "_axisB" ]; _dir = markerDir _mrk; _rndDir = random 360; _rndX = cos _rndDir * ( random _axisA ); _rndY = sin _rndDir * ( random _axisB ); _rndPos = [ [ _rndX, _rndY, 0 ], -_dir ] call BIS_fnc_rotateVector2D; _rndPos vectorAdd _pos }; //Create 1000 test positions for "_i" from 1 to 1000 do { _position = [ _mrk ] call TAG_fnc_randomMarkerPos; _rndMrk = createMarker [ format[ "test_%1", _i ], _position ]; _rndMrk setMarkerShape "ICON"; _rndMrk setMarkerType "hd_dot"; _rndMrk setMarkerDir 0; _rndMrk setMarkerColor "ColorRed"; _rndMrk setMarkerAlpha 1; _rndMrk setMarkerText ""; }; Share this post Link to post Share on other sites
killzone_kid 1332 Posted May 4, 2017 Or you can use BIS_fnc_randomPosTrigger Share this post Link to post Share on other sites
beno_83au 1369 Posted May 4, 2017 1 hour ago, killzone_kid said: Or you can use BIS_fnc_randomPosTrigger Would inArea be a better option as opposed to the function or not? Share this post Link to post Share on other sites
killzone_kid 1332 Posted May 4, 2017 37 minutes ago, beno_83au said: Would inArea be a better option as opposed to the function or not? I dunno, it is like asking which command is better getPos or saveVar? 2 Share this post Link to post Share on other sites
beno_83au 1369 Posted May 4, 2017 Ahhh yep, sorry, not sure where i was going with that one. 1 Share this post Link to post Share on other sites
SilentSpike 84 Posted May 4, 2017 6 hours ago, killzone_kid said: Or you can use BIS_fnc_randomPosTrigger Worth noting that this function doesn't produce uniformly distributed points when used on an ellipse. See 1000 plotted point with both BIS function and CBA function on identical circles here: Link to current version of the CBA function 1 Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted May 4, 2017 35 minutes ago, silentspike said: Worth noting that this function doesn't produce uniformly distributed points when used on an ellipse. See 1000 plotted point with both BIS function and CBA function on identical circles here: Link to current version of the CBA function sqrt to the face! Cheers 2 Share this post Link to post Share on other sites
killzone_kid 1332 Posted May 4, 2017 16 minutes ago, Grumpy Old Man said: sqrt to the face! Cheers OFC! Share this post Link to post Share on other sites
Gen. MERICA 3 Posted May 4, 2017 Both of these methods work perfectly, glad to see that people have these on stand by. They should really bundle some of the Take on helicopters functions into the default scripting area, I never check the functions outside of the Arma 3 search. Share this post Link to post Share on other sites