Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ["_arx", "_rad", "_cnt", "_debug", "_ref", "_pef", "_sef", "_def", "_ref1", "_pef1", "_sef1", "_def1", "_ref2", "_pef2", "_sef2",
- "_def2", "_ref3", "_pef3", "_sef3", "_def3", "_ref4", "_pef4", "_sef4", "_def4", "_ref5", "_pef5", "_sef5", "_def5", "_ref6", "_pef6",
- "_sef6", "_def6", "_newPos", "_otherPos", "_m"];
- _arx = _this select 0; //массив
- _rad = _this select 1; //радиус субмассива
- _cnt = _this select 2; // минимальное кол -во в субмассиве
- _debug = true;
- _ref=[];
- _pef=[];
- _sef=[];
- _def =[];
- _ref1=[];
- _pef1=[];
- _sef1=[];
- _def1 =[];
- _ref2=[];
- _pef2=[];
- _sef2=[];
- _def2 =[];
- _ref3=[];
- _pef3=[];
- _sef3=[];
- _def3 =[];
- _ref4=[];
- _pef4=[];
- _sef4=[];
- _def4 =[];
- _ref5=[];
- _pef5=[];
- _sef5=[];
- _def5 =[];
- _ref6=[];
- _pef6=[];
- _sef6=[];
- _def6 =[];
- if ((count _arx) > 0) then
- {
- {
- call
- {
- if (((_arx select 0) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _ref set [count _ref,_newPos];
- };
- if (((_arx select (count _arx - 1)) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _pef set [count _pef,_newPos];
- };
- if (((_arx select (floor((count _arx)*0.5))) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _sef set [count _sef,_newPos];
- };
- _otherPos = _x;
- _def set [count _def,_otherPos];
- };
- } foreach _arx;
- };
- if ((count _def) > 0) then
- {
- {
- call
- {
- if (((_def select 0) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _ref1 set [count _ref1,_newPos];
- };
- if (((_def select (count _def - 1)) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _pef1 set [count _pef1,_newPos];
- };
- if (((_def select (floor((count _def)*0.5))) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _sef1 set [count _sef1,_newPos];
- };
- _otherPos = _x;
- _def1 set [count _def1,_otherPos];
- };
- } foreach _def;
- };
- if ((count _def1) > 0) then
- {
- {
- call
- {
- if (((_def1 select 0) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _ref2 set [count _ref2,_newPos];
- };
- if (((_def1 select (count _def1 - 1)) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _pef2 set [count _pef2,_newPos];
- };
- if (((_def1 select (floor((count _def1)*0.5))) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _sef2 set [count _sef2,_newPos];
- };
- _otherPos = _x;
- _def2 set [count _def2,_otherPos];
- };
- } foreach _def1;
- };
- if ((count _def2) > 0) then
- {
- {
- call
- {
- if (((_def2 select 0) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _ref3 set [count _ref3,_newPos];
- };
- if (((_def2 select (count _def2 - 1)) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _pef3 set [count _pef3,_newPos];
- };
- if (((_def2 select (floor((count _def2)*0.5))) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _sef3 set [count _sef3,_newPos];
- };
- _otherPos = _x;
- _def3 set [count _def3,_otherPos];
- };
- } foreach _def2;
- };
- if ((count _def3) > 0) then
- {
- {
- call
- {
- if (((_def3 select 0) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _ref4 set [count _ref4,_newPos];
- };
- if (((_def3 select (count _def3 - 1)) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _pef4 set [count _pef4,_newPos];
- };
- if (((_def3 select (floor((count _def3)*0.5))) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _sef4 set [count _sef4,_newPos];
- };
- _otherPos = _x;
- _def4 set [count _def4,_otherPos];
- };
- } foreach _def3;
- };
- if ((count _def4) > 0) then
- {
- {
- call
- {
- if (((_def4 select 0) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _ref5 set [count _ref5,_newPos];
- };
- if (((_def4 select (count _def4 - 1)) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _pef5 set [count _pef5,_newPos];
- };
- if (((_def4 select (floor((count _def4)*0.5))) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _sef5 set [count _sef5,_newPos];
- };
- _otherPos = _x;
- _def5 set [count _def5,_otherPos];
- };
- } foreach _def4;
- };
- if ((count _def5) > 0) then
- {
- {
- call
- {
- if (((_def5 select 0) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _ref6 set [count _ref6,_newPos];
- };
- if (((_def5 select (count _def5 - 1)) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _pef6 set [count _pef6,_newPos];
- };
- if (((_def5 select (floor((count _def5)*0.5))) distance _x) < _rad ) exitwith
- {
- _newPos = _x;
- _sef6 set [count _sef6,_newPos];
- };
- _otherPos = _x;
- _def6 set [count _def6,_otherPos];
- };
- } foreach _def5;
- };
- _arx resize 0;
- if ((count _ref)>=_cnt) then { _arx set [count _arx, _ref];};
- if ((count _pef)>=_cnt) then { _arx set [count _arx, _pef];};
- if ((count _sef)>=_cnt) then { _arx set [count _arx, _sef];};
- if ((count _ref1)>=_cnt) then { _arx set [count _arx, _ref1];};
- if ((count _pef1)>=_cnt) then { _arx set [count _arx, _pef1];};
- if ((count _sef1)>=_cnt) then { _arx set [count _arx, _sef1];};
- if ((count _ref2)>=_cnt) then { _arx set [count _arx, _ref2];};
- if ((count _pef2)>=_cnt) then { _arx set [count _arx, _pef2];};
- if ((count _sef2)>=_cnt) then { _arx set [count _arx, _sef2];};
- if ((count _ref3)>=_cnt) then { _arx set [count _arx, _ref3];};
- if ((count _pef3)>=_cnt) then { _arx set [count _arx, _pef3];};
- if ((count _sef3)>=_cnt) then { _arx set [count _arx, _sef3];};
- if ((count _ref4)>=_cnt) then { _arx set [count _arx, _ref4];};
- if ((count _pef4)>=_cnt) then { _arx set [count _arx, _pef4];};
- if ((count _sef4)>=_cnt) then { _arx set [count _arx, _sef4];};
- if ((count _ref5)>=_cnt) then { _arx set [count _arx, _ref5];};
- if ((count _pef5)>=_cnt) then { _arx set [count _arx, _pef5];};
- if ((count _sef5)>=_cnt) then { _arx set [count _arx, _sef5];};
- if ((count _ref6)>=_cnt) then { _arx set [count _arx, _ref6];};
- if ((count _pef6)>=_cnt) then { _arx set [count _arx, _pef6];};
- if ((count _sef6)>=_cnt) then { _arx set [count _arx, _sef6];};
- if _debug then {
- _color = [];
- _color =["ColorBlack","ColorRed","ColorGreen",
- "ColorBlue",
- "ColorYellow",
- "ColorGreenAlpha",
- "ColorOrange",
- "ColorWhite",
- "ColorPink",
- "ColorBrown",
- "ColorRedAlpha",
- "ColorKhaki"];
- _markercolor = "ColorBlack";
- {
- _index=str _forEachIndex;
- if ((count _arx) <= 12) then
- {
- _markercolor = _color select _forEachIndex;
- }else{
- _markercolor = _color select (floor random (count _color));
- };
- {
- _m = createMarker["marker5" + _index + (str _forEachIndex), [ _x select 0,_x select 1]];
- _m setMarkerShape "ICON";
- _m setMarkerType "DOT";
- _m setmarkercolor _markercolor;
- } foreach _x;
- } foreach _arx;
- };
- _arx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement