Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- File: fnc_spiral.sqf
- Author: ArseniyK
- Used scripts:
- Description:
- Creating spiral
- Parameter(s):
- _this select 0: position (Array)
- _this select 1: step (Number)
- (_this select 2) select 0: min radius (Number)
- _maxrad = (_this select 2) select 1: max radius
- Returns:
- Array - format PositionASL
- */
- private ["_pos","_step","_minrad","_maxrad","_posx","_a","_posy","_x","_y","_arr","_debug","_r","_tx","_ty","_len","_k"];
- _pos = _this select 0;
- _step = _this select 1;
- _minrad = (_this select 2) select 0;
- _maxrad = (_this select 2) select 1;
- _debug = false;
- //=============Creating spiral=============//
- step = _step;
- _a = -0.3* step;
- _posx = _pos select 0;
- _posy = _pos select 1;
- _x = _minrad;
- _y = 1;
- _arr=[];
- for [{_i=0},{true},{_i=_i+1}] do
- {
- _r = sqrt (_x*_x+_y*_y);
- _tx = _a*_x+_r*_y;
- _ty = _a*_y - _r*_x;
- _len = sqrt(_tx*_tx + _ty*_ty);
- _k = step/_len;
- _x = _x + _tx*_k;
- _y = _y + _ty*_k;
- _arr set [_i,[_x+_posx,_y+_posy,getTerrainHeightASL [_x+_posx, _y+_posy]]];
- if (((ASLToATL (_arr select _i)) distance _pos) >= _maxrad) exitwith {};
- };
- if _debug then
- {
- {
- call compile format ["
- _m%1 = createMarker[""markerRed%1"",[ _x select 0,_x select 1]];
- _m%1 setMarkerShape ""ICON"";
- _m%1 setMarkerType ""DOT"";
- _m%1 setmarkercolor ""Colorred""; ",_forEachIndex];
- } foreach _arr;
- };
- _arr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement