Jump to content

Search the Community

Showing results for tags 'algorithm'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • BOHEMIA INTERACTIVE
    • BOHEMIA INTERACTIVE - NEWS
    • BOHEMIA INTERACTIVE - JOBS
    • BOHEMIA INTERACTIVE - GENERAL
  • FEATURED GAMES
    • Vigor
    • DAYZ
    • ARMA 3
    • ARMA 2
    • YLANDS
  • MOBILE GAMES
    • ARMA MOBILE OPS
    • MINIDAYZ
    • ARMA TACTICS
    • ARMA 2 FIRING RANGE
  • BI MILITARY GAMES FORUMS
  • BOHEMIA INCUBATOR
    • PROJECT LUCIE
  • OTHER BOHEMIA GAMES
    • ARGO
    • TAKE ON MARS
    • TAKE ON HELICOPTERS
    • CARRIER COMMAND: GAEA MISSION
    • ARMA: ARMED ASSAULT / COMBAT OPERATIONS
    • ARMA: COLD WAR ASSAULT / OPERATION FLASHPOINT
    • IRON FRONT: LIBERATION 1944
    • BACK CATALOGUE
  • OFFTOPIC
    • OFFTOPIC
  • ArmA Toolmakers's Releases
  • ArmA Toolmakers's General
  • Die Hard OFP Lovers' Club's Topics
  • Japan in Arma's Topics
  • Arma 3 Photography Club's Discussions
  • The Order Of the Wolfs- Unit's Topics
  • 4th Infantry Brigade's Recruitment
  • 11th Marine Expeditionary Unit OFFICIAL | 11th MEU(SOC)'s 11th MEU(SOC) Recruitment Status - OPEN
  • Legion latina semper fi's New Server Legion latina next wick
  • Legion latina semper fi's https://www.facebook.com/groups/legionlatinasemperfidelis/
  • Legion latina semper fi's Server VPN LEGION LATINA SEMPER FI
  • Team Nederland's Welkom bij ons club
  • Team Nederland's Facebook
  • [H.S.O.] Hellenic Special Operations's Infos

XBOX Live


PlayStation PSN


Origin


PlayFire


SoundCloud


Pinterest


Reddit


Twitch.Tv


Ustream.Tv


Duxter


Instagram


Location


Interests


Interests


Occupation

Found 3 results

  1. Voronoi diagram using Fortune's algorithm Here's a set of functions developed for my current project to generate Voronoi diagrams in SQF without the need for addons. What does it do? The code generates the edges of the Voronoi diagram from a given set of sites (positions). If you do not yet know what a Voronoi diagram is or what it's uses are check out https://en.wikipedia.org/wiki/Voronoi_diagram. Example: Using the Altis towns as sites How do I use it? Installation: Download the example mission to get the code. Copy the voronoi folder to your mission. In your missions CfgFunctions class include "voronoi\cfgfunctions.ext" like so: class CfgFunctions { #include "voronoi\cfgfunctions.ext" }; Execution: The only included function you will need to call is VOR_fnc_getEdges: private _edges = [_sites, _width, _height] call VOR_fnc_getEdges; VOR_fnc_getEdges takes an array of sites (position2Ds), and width and height in meters for the area to scan. All sites must be inside the rectangle [0,0] and [width, height]. The function returns an array of edges that constitute the Voronoi diagram. Each edge is an array composed of: [ EDGE_START, - Start position EDGE_END, - End position EDGE_LEFT, - Site on the left EDGE_RIGHT, - Site on the right EDGE_NEIGHBOUR, - Internal usage EDGE_LINE_F, - f in the function for the edge's line: y = fx + g EDGE_LINE_G, - g in the function for the edge's line: y = fx + g EDGE_DIRECTION - 2-dimensional direction vector of the ray going from start to end, not normalized. ] Where do I get it? Link (voronoi_example.Altis.zip) Examples Known issues In some cases some edges may not find an intersection and only intersect with the bounding box. I haven't managed to isolate the issue yet but it seems to be a precision error in the intersection check. Suggestions are welcome. It's slow. For 50 sites a call in-mission takes about ~0.5 seconds which is very slow compared to good c++ code. Not entirely sure yet if it's because of my implementation or just SQF having a hard time with the complexity. In my in-mission testing 50 sites took about 0.5 seconds in an unscheduled environment and in scheduled took 1-2.5 seconds. During mission init the code is significantly faster, clocking in 150 sites in about 0.5 seconds. I can put this down partly to the way I handle data but not sure how much quicker I could make it. If anyone has the energy to dissect the code I'd love hear your input. Feedback Constructive feedback is always welcome. I've probably missed cases where the code will break. If you're reporting a bug please if possible also submit the following: The complete set of sites passed. Height and width passed.
  2. ArmA 3 really annoys me because it lacks a dictionary data type I know you are going to direct me to the BIS_fnc_addToPairs, but there is no actual dictionary datatype in arma 3. The reason i say this is because. Binary search will allow me to traverse a large array data set much quicker than forEach array; Only problem is sorting the data which is mission specific such as town locations is not possible because attempting to sort the array will result in it's meaning lost. _array = _this select 0; _arrayCount = count _array; _requestedElement = _this select 1; _low = 0; _high = _arrayCount; while {_low <= _high} do { //Comupute mid point _mid = round(_low + (_high - _low) / 2); diag_log format ["_mid: %1",_mid]; _indexReturn = {_x == _requestedElement} count _array; diag_log format ["_indexReturn: %1",_indexReturn]; if (_requestedElement isEqualTo (_array select _mid)) then { _pulledData = _array select _mid; diag_log format ["_pulledData: %1",_pulledData]; } else { if (_indexReturn < _mid) then { _low = _mid + 1; } else { _high = _mid - 1; } }; }; _pulleddata Data Pulled: ["Gravia",[14479.8,17614.3,-21.6749], "Telos",[16207,17296.7,-24.3308], "Athira",[13993,18709.4,-25.735], "Lakka",[12282,15732.3,-23.0026], "Frini",[14612.5,20786.7,-47.0032], "Charkia",[18049.1,15264.1,-28.4237], "Rodopoli",[18753.4,16597.1,-32.1656], "Neochori",[12502,14337,-11.5868], "Pyrgos",[16780.6,12604.5,-18.9913], "Paros",[20885.4,16958.8,-49.8089], "Dorida",[19336.9,13252.3,-37.8615], "Poliakko",[10966.5,13435.3,-28.4601], "Kalochori",[21351.6,16361.9,-20.5678], "Agios Dionysios",[9187.95,15947.8,-124.829], "Syrta",[8625.13,18301.6,-179.297], "Chalkeia",[20194.6,11660.7,-45.8388], "Zaros",[9091.81,11961.9,-19.9013], "Kore",[7062.42,16472.1,-116.425], "Sofia",[25680.5,21365.1,-20.7333], "Kavala",[3458.95,12966.4,-6.1822], "Molos",[26943.9,23170.7,-18.0848]] Numerical keys that are sequential are required for this to work. As a binary search is best used on hash-table keys. Any know of any dictionary methods for arma 3?
  3. I'm sure there's a way to minimize the number of lines in this code. I have three variables, each of them needs to get through a simple math function : f(x)=10x. _var1 = 0.2; _var2 = 0.7; _var3 = 0.5; _array = [_var1,_var2,_var3]; _var1 = _var1 * 10; _var2 = _var2 * 10; _var3 = _var3 * 10; If I have let say ten vars, is it better to use the brute way (see snip above), use a foreach command or use a function (optimization wise). Probably the function, isn't it ?
×