Page 1 of 1
Expanding Circle Refpoints
Posted: Sat Jul 25, 2020 1:16 pm
by Parel803
First let me thank all that always willing to help me out in the Lua stuff, I'm no programmer at all, so it's pretty hard.
I learned here to make a cicle with refpoints based on a Lat/Long.
Question 1: is it possible to make this cicle with an expanding radius (based on speed)?
Question 2: is it possible to make the centre of a circle on an existing track?
The reason I'm trying this is that I want a area where a unit might be based on a intelligence message, postion course and speed. Try to make a third (blind) side with the intel information. Hoping it makes some sense.
with regards
RE: Expanding Circle Refpoints
Posted: Mon Jul 27, 2020 11:44 pm
by Rory Noonan
Yes, you can simply modify the position of existing reference points--moving them closer to or further from the centrepoint as necessary to contract and expand the circle respectively.
To centre the circle on an existing track, simply use the lat/lon of the existing track as the centrepoint. If you want the circle to move with the track, you can make the reference points relative to the track.
RE: Expanding Circle Refpoints
Posted: Tue Jul 28, 2020 1:50 pm
by Parel803
Thank you very much, gonna try tonight.
With regards
RE: Expanding Circle Refpoints
Posted: Tue Jul 28, 2020 4:38 pm
by Parel803
I now have some Refpoints around a unit. This from the help in another thread. For a circle, do I make just more refpoints, or is there an easier way to make a circle around a unit. Thanks
with regards
RE: Expanding Circle Refpoints
Posted: Wed Jul 29, 2020 12:10 am
by Rory Noonan
To place a circle of RPs around a unit
local unit = ScenEdit_GetUnit({side='pick a side',name='pick a unit'})
local circle = World_GetCircleFromPoint({latitude = unit.latitude, longitude = unit.longitude, numpoints = 12})
for each,point in ipairs(circle) do
rp = ScenEdit_AddReferencePoint({side='pick a side',name='pick a name '..each, latitude=point.latitude, longitude=point.longitude})
end
To change an existing circle of RPs radius (using the example names from code above)
local newRadius = 25
local unit = ScenEdit_GetUnit({side='pick a side',name='pick a unit'})
local circle = World_GetCircleFromPoint({latitude = unit.latitude, longitude = unit.longitude, numpoints = newRadius})
for each,point in ipairs(circle) do
rp = ScenEdit_GetReferencePoint({side='pick a side', name='pick a name '..each})
ScenEdit_SetReferencePoint({side=rp.side, guid=rp.guid, latitude=point.latitude, longitude=point.longitude})
end
https://commandlua.github.io/#World_GetCircleFromPoint
RE: Expanding Circle Refpoints
Posted: Wed Jul 29, 2020 12:18 pm
by Parel803
Thx again for you're time and answer. Much appriciated.
with regards