Michal Pielaszkiewicz
Posts: 18
Joined: 9/23/2014 Status: offline
|
Hi, Recently I was frustrated witch placing SAM's and assigning for it areas, trying to make it circle... I've found code on Baloogan forum (unfortunately now I can not enter his forum?) that creates "circles" from RP's, unfortunately that script works only on equator and with increasing deviation shape of circles is getting werid, so I've modified original code to include nav. deviation - now circles are nice at any latitude, I've also changed inputs, so now you have to provide unit which is center of area, radius in Nm and number of verticals. How to use, First paste this code to script console and run:
-- RP.01
-- Written by Baloogan
-- Modified draw_circle by Yautay
function draw_circle(a,b,t,txt)
if txt == nil then
txt = ""
end
t = t
tg = t - 1
lat1 = a.latitude
lon1 = a.longitude
r = b / 60
for i=0,tg do
th = 2 * math.pi * i / t
rlat = lat1 + r * math.cos(th)
rlon = lon1 + r * math.sin(th) / math.cos(math.rad(lat1))
ScenEdit_AddReferencePoint({
side='PlayerSide',
lat=rlat,
lon=rlon,
name=txt,
highlighted="yes"})
end
end
Now paste this code, change red syntax for your own side/unit name (here is Red and test), change radius (350) and desired number of verticals (24). Run it...
local unit = ScenEdit_GetUnit({side="Red", name="test"})
draw_circle({latitude=unit.latitude, longitude=unit.longitude}, 350, 24, "RP")
< Message edited by Michal Pielaszkiewicz -- 9/30/2016 4:19:21 PM >
|