mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
AWACS - 0.0.12
This commit is contained in:
parent
04c77e9760
commit
21f93aa7e8
@ -176,6 +176,7 @@ end
|
|||||||
-- @param DCS#Vec3 Vec3 The point to test.
|
-- @param DCS#Vec3 Vec3 The point to test.
|
||||||
-- @return #boolean true if the Vec3 is within the zone.
|
-- @return #boolean true if the Vec3 is within the zone.
|
||||||
function ZONE_BASE:IsVec3InZone( Vec3 )
|
function ZONE_BASE:IsVec3InZone( Vec3 )
|
||||||
|
if not Vec3 then return false end
|
||||||
local InZone = self:IsVec2InZone( { x = Vec3.x, y = Vec3.z } )
|
local InZone = self:IsVec2InZone( { x = Vec3.x, y = Vec3.z } )
|
||||||
return InZone
|
return InZone
|
||||||
end
|
end
|
||||||
@ -2004,7 +2005,9 @@ end
|
|||||||
-- @return #boolean true if the point is within the zone.
|
-- @return #boolean true if the point is within the zone.
|
||||||
function ZONE_POLYGON_BASE:IsVec3InZone( Vec3 )
|
function ZONE_POLYGON_BASE:IsVec3InZone( Vec3 )
|
||||||
self:F2( Vec3 )
|
self:F2( Vec3 )
|
||||||
|
|
||||||
|
if not Vec3 then return false end
|
||||||
|
|
||||||
local InZone = self:IsVec2InZone( { x = Vec3.x, y = Vec3.z } )
|
local InZone = self:IsVec2InZone( { x = Vec3.x, y = Vec3.z } )
|
||||||
|
|
||||||
return InZone
|
return InZone
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1661,13 +1661,16 @@ end
|
|||||||
function INTEL:CalcClusterDirection(cluster)
|
function INTEL:CalcClusterDirection(cluster)
|
||||||
|
|
||||||
local direction = 0
|
local direction = 0
|
||||||
|
local speedsum = 0
|
||||||
local n=0
|
local n=0
|
||||||
for _,_contact in pairs(cluster.Contacts) do
|
for _,_contact in pairs(cluster.Contacts) do
|
||||||
local contact=_contact --#INTEL.Contact
|
local contact=_contact --#INTEL.Contact
|
||||||
|
|
||||||
if (not contact.isStatic) and contact.group:IsAlive() then
|
if (not contact.isStatic) and contact.group:IsAlive() then
|
||||||
direction = direction + contact.group:GetHeading()
|
local speed = contact.group:GetVelocityKNOTS()
|
||||||
|
direction = direction + (contact.group:GetHeading()*speed)
|
||||||
n=n+1
|
n=n+1
|
||||||
|
speedsum = speedsum + speed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1678,13 +1681,14 @@ function INTEL:CalcClusterDirection(cluster)
|
|||||||
-- Total is 360/2=180, i.e. South!
|
-- Total is 360/2=180, i.e. South!
|
||||||
-- It should not go anywhere as the two movements cancel each other.
|
-- It should not go anywhere as the two movements cancel each other.
|
||||||
-- Correct, edge case for N=2^x, but when 2 pairs of groups drive in exact opposite directions, the cluster will split at some point?
|
-- Correct, edge case for N=2^x, but when 2 pairs of groups drive in exact opposite directions, the cluster will split at some point?
|
||||||
-- maybe add the speed as weight to get a factor
|
-- maybe add the speed as weight to get a weighted factor
|
||||||
|
|
||||||
if n==0 then
|
if n==0 then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return math.floor(direction / n)
|
return math.floor(direction / (speedsum * n ))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Calculate cluster speed.
|
--- Calculate cluster speed.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user