mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Progress
This commit is contained in:
parent
3106f62709
commit
312007b51c
BIN
Moose Development/Maths/Aspect.ggb
Normal file
BIN
Moose Development/Maths/Aspect.ggb
Normal file
Binary file not shown.
@ -309,6 +309,8 @@ function POINT_VEC3:New( x, y, z )
|
||||
self.y = y
|
||||
self.z = z
|
||||
|
||||
self:SetMetric( true )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -589,7 +591,7 @@ end
|
||||
-- @return #string Altitude text.
|
||||
function POINT_VEC3:GetAltitudeText()
|
||||
if self:IsMetric() then
|
||||
return ' at ' .. UTILS.Round( self:GetY(), 0 )
|
||||
return ' at ' .. UTILS.Round( self:GetY(), -3 )
|
||||
else
|
||||
return ' at ' .. UTILS.Round( UTILS.MetersToFeet( self:GetY() ), 0 )
|
||||
end
|
||||
@ -876,11 +878,8 @@ end
|
||||
function POINT_VEC2:NewFromVec3( Vec3 )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
local Vec2 = { x = Vec3.x, y = Vec3.z }
|
||||
|
||||
local LandHeight = land.getHeight( Vec2 )
|
||||
|
||||
self = BASE:Inherit( self, POINT_VEC3:New( Vec2.x, LandHeight, Vec2.y ) )
|
||||
self = BASE:Inherit( self, POINT_VEC3:New( Vec3.x, Vec3.y, Vec3.z ) )
|
||||
self:F2( self )
|
||||
|
||||
return self
|
||||
@ -1074,12 +1073,17 @@ do -- COORDINATE
|
||||
-- @return Core.Point#COORDINATE self
|
||||
function COORDINATE:NewFromVec3( Vec3 ) --R2.1 Fixes issue #424.
|
||||
|
||||
self = BASE:Inherit( self, POINT_VEC2:NewFromVec3( Vec3 ) ) -- Core.Point#COORDINATE
|
||||
self = BASE:Inherit( self, POINT_VEC3:NewFromVec3( Vec3 ) ) -- Core.Point#COORDINATE
|
||||
self:F2( self )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function COORDINATE:SetHeading( Heading )
|
||||
self.Heading = Heading
|
||||
end
|
||||
|
||||
|
||||
--- Return a BR string from a COORDINATE to the COORDINATE.
|
||||
-- @param #COORDINATE self
|
||||
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
|
||||
@ -1100,7 +1104,7 @@ do -- COORDINATE
|
||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||
local Distance = self:Get2DDistance( TargetCoordinate )
|
||||
local Altitude = self:GetAltitudeText()
|
||||
return "BRAA: " .. self:GetBRText( AngleRadians, Distance ) .. Altitude .. ", flanking"
|
||||
return "BRAA: " .. self:GetBRText( AngleRadians, Distance )
|
||||
end
|
||||
|
||||
--- Return a BULLS string from a COORDINATE to the BULLS of the coalition.
|
||||
@ -1113,7 +1117,34 @@ do -- COORDINATE
|
||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||
local Distance = self:Get2DDistance( TargetCoordinate )
|
||||
local Altitude = self:GetAltitudeText()
|
||||
return "BULLS: " .. self:GetBRText( AngleRadians, Distance ) .. Altitude .. ", flanking"
|
||||
return "BULLS: " .. self:GetBRText( AngleRadians, Distance )
|
||||
end
|
||||
|
||||
--- Return an aspect string from a COORDINATE to the Angle of the object.
|
||||
-- @param #COORDINATE self
|
||||
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
|
||||
-- @return #string The Aspect string, which is Hot, Cold or Flanking.
|
||||
function COORDINATE:ToStringAspect( TargetCoordinate )
|
||||
local Heading = self.Heading
|
||||
local DirectionVec3 = self:GetDirectionVec3( TargetCoordinate )
|
||||
local Angle = self:GetAngleDegrees( DirectionVec3 )
|
||||
|
||||
if Heading then
|
||||
local Aspect = Angle - Heading
|
||||
if Aspect > -135 and Aspect <= -45 then
|
||||
return "Flanking"
|
||||
end
|
||||
if Aspect > -45 and Aspect <= 45 then
|
||||
return "Hot"
|
||||
end
|
||||
if Aspect > 45 and Aspect <= 135 then
|
||||
return "Flanking"
|
||||
end
|
||||
if Aspect > 135 or Aspect <= -135 then
|
||||
return "Cold"
|
||||
end
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
--- Provides a Lat Lon string
|
||||
|
||||
@ -1192,7 +1192,7 @@ do -- DETECTION_BASE
|
||||
end
|
||||
|
||||
DetectedItem.Set = Set or SET_UNIT:New():FilterDeads():FilterCrashes()
|
||||
DetectedItem.Index = DetectedItemIndex
|
||||
DetectedItem.Index = DetectedItemIndex or self.DetectedItemCount
|
||||
DetectedItem.ItemID = ItemPrefix .. "." .. self.DetectedItemMax
|
||||
DetectedItem.ID = self.DetectedItemMax
|
||||
DetectedItem.Removed = false
|
||||
@ -1312,16 +1312,21 @@ do -- DETECTION_BASE
|
||||
function DETECTION_BASE:GetDetectedItemCoordinate( Index )
|
||||
|
||||
-- If the Zone is set, return the coordinate of the Zone.
|
||||
local DetectedItemSet = self:GetDetectedSet( Index )
|
||||
local FirstUnit = DetectedItemSet:GetFirst()
|
||||
|
||||
local DetectedZone = self:GetDetectedItemZone( Index )
|
||||
if DetectedZone then
|
||||
return DetectedZone:GetCoordinate()
|
||||
local Coordinate = DetectedZone:GetCoordinate()
|
||||
Coordinate:SetHeading(FirstUnit:GetHeading())
|
||||
return Coordinate
|
||||
end
|
||||
|
||||
-- If no Zone is set, return the coordinate of the first unit in the Set
|
||||
local DetectedItemSet = self:GetDetectedSet( Index )
|
||||
local FirstUnit = DetectedItemSet:GetFirst()
|
||||
if FirstUnit then
|
||||
return FirstUnit:GetCoordinate()
|
||||
local Coordinate = FirstUnit:GetCoordinate()
|
||||
FirstUnit:SetHeading(FirstUnit:GetHeading())
|
||||
return Coordinate
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
@ -1404,9 +1404,7 @@ function TASK:ReportDetails( TaskGroup ) --R2.1 fixed report. Now nicely formatt
|
||||
if TaskInfoID == "Coordinates" then
|
||||
local FromCoordinate = TaskGroup:GetUnit(1):GetCoordinate()
|
||||
Report:Add( TaskInfoIDText )
|
||||
Report:AddIndent( TaskInfo:ToStringLL() )
|
||||
Report:AddIndent( TaskInfo:ToStringMGRS() )
|
||||
Report:AddIndent( TaskInfo:ToStringBRAA( FromCoordinate ) )
|
||||
Report:AddIndent( TaskInfo:ToStringBRAA( FromCoordinate ) .. ", " .. TaskInfo:ToStringAspect( FromCoordinate ) )
|
||||
Report:AddIndent( TaskInfo:ToStringBULLS( TaskGroup:GetCoalition() ) )
|
||||
else
|
||||
end
|
||||
|
||||
@ -73,6 +73,7 @@ do -- TASK_A2A_DISPATCHER
|
||||
|
||||
self.Detection:FilterCategories( Unit.Category.AIRPLANE, Unit.Category.HELICOPTER )
|
||||
self.Detection:InitDetectRadar( true )
|
||||
self.Detection:SetDetectionInterval(30)
|
||||
|
||||
self:AddTransition( "Started", "Assign", "Started" )
|
||||
|
||||
@ -191,6 +192,7 @@ do -- TASK_A2A_DISPATCHER
|
||||
Task:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
||||
Task:SetInfo( "Coordinates", Detection:GetDetectedItemCoordinate( DetectedIndex ) )
|
||||
Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) )
|
||||
Task:SetInfo( "Object", DetectedSet:GetFirst() )
|
||||
Mission:AddTask( Task )
|
||||
else
|
||||
self:E("This should not happen")
|
||||
|
||||
@ -149,6 +149,7 @@ function POSITIONABLE:GetCoordinate()
|
||||
local PositionableVec3 = self:GetPositionVec3()
|
||||
|
||||
local PositionableCoordinate = COORDINATE:NewFromVec3( PositionableVec3 )
|
||||
PositionableCoordinate:SetHeading( self:GetHeading() )
|
||||
|
||||
self:T2( PositionableCoordinate )
|
||||
return PositionableCoordinate
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user