This commit is contained in:
Sven Van de Velde 2016-08-12 09:06:50 +02:00
parent d47e3183e3
commit e59caac2c7
3 changed files with 46 additions and 11 deletions

View File

@ -66,6 +66,19 @@ POINT_VEC3 = {
},
}
--- The POINT_VEC2 class
-- @type POINT_VEC2
-- @extends #POINT_VEC3
-- @field DCSTypes#Distance x The x coordinate in meters.
-- @field DCSTypes#Distance y the y coordinate in meters.
POINT_VEC2 = {
ClassName = "POINT_VEC2",
x = 0,
y = 0,
}
do -- POINT_VEC3
--- SmokeColor
-- @type POINT_VEC3.SmokeColor
@ -373,6 +386,20 @@ function POINT_VEC3:IsMetric()
return self.Metric
end
--- Add a Distance in meters from the POINT_VEC3 horizontal plane, with the given angle, and calculate the new POINT_VEC3.
-- @param #POINT_VEC3 self
-- @param DCSTypes#Distance Distance The Distance to be added in meters.
-- @param DCSTypes#Angle Angle The Angle in degrees.
-- @return #POINT_VEC3 The new calculated POINT_VEC3.
function POINT_VEC3:Translate( Distance, Angle )
local SX = self:GetX()
local SZ = self:GetZ()
local Radians = Angle / 180 * math.pi
local TX = Distance * math.cos( Radians ) + SX
local TZ = Distance * math.sin( Radians ) + SZ
return POINT_VEC3:New( TX, self:GetY(), TZ )
end
@ -543,17 +570,13 @@ function POINT_VEC3:FlareRed( Azimuth )
self:Flare( POINT_VEC3.FlareColor.Red, Azimuth )
end
end
--- The POINT_VEC2 class
-- @type POINT_VEC2
-- @extends Point#POINT_VEC3
-- @field #number x The x coordinate in 2D space.
-- @field #number y the y coordinate in 2D space.
POINT_VEC2 = {
ClassName = "POINT_VEC2",
}
do -- POINT_VEC2
--- Create a new POINT_VEC2 object.
--- POINT_VEC2 constructor.
-- @param #POINT_VEC2 self
-- @param DCSTypes#Distance x The x coordinate of the Vec3 point, pointing to the North.
-- @param DCSTypes#Distance y The y coordinate of the Vec3 point, pointing to the Right.
@ -689,5 +712,6 @@ function POINT_VEC2:Translate( Distance, Angle )
return POINT_VEC2:New( TX, TY )
end
end

View File

@ -606,8 +606,10 @@ function SPAWN:SpawnFromVec3( Vec3, RandomizeUnits, OuterRadius, InnerRadius, Sp
else
for UnitID = 1, #SpawnTemplate.units do
local UnitTemplate = SpawnTemplate.units[UnitID]
local UnitPointVec3 = POINT_VEC3:New( UnitTemplate.x, UnitTemplate.alt, UnitTemplate.y )
UnitPointVec3 = UnitPointVec3:
local UnitPointVec2 = POINT_VEC2:New( UnitTemplate.x, UnitTemplate.y )
local Distance = UnitPointVec2
local Angle = UnitPointVec2:GetAngle( PointVec3 )
UnitPointVec2 = UnitPointVec2:Translate( Distance, Angle )
local RandomVec2 = PointVec3:GetRandomVec2InRadius( OuterRadius, InnerRadius )
SpawnTemplate.units[UnitID].x = RandomVec2.x
SpawnTemplate.units[UnitID].y = RandomVec2.y

View File

@ -2,6 +2,15 @@
- Temporary release of the new cargo handling.
-- Released available functionality to handle one CARGO_UNIT loading, boarding, unloading.
-- Created CARGO_UNIT test missions.
- Added Translate() method in POINT_VEC3, translating a 3D point over the horizontal plane with a Distance and Angle coordinate.
- Changed Spawn APIs, adding RandomizeGroup and RandomizeUnits parameters, to express Group position and Unit position randomization.
-- Changed SpawnInZone() method.
--- RandomizeGroup is used to randomize the start position of the Group in a zone.
--- RandomizeUnits is used to randomize the start position of the Units in a defined radius band, through OuterRadius and InnerRadius parameters.
-- Changed SpawnFromVec3() method.
--- RandomizeUnits is used to randomize the start position of the Units in a defined radius band, through OuterRadius and InnerRadius parameters.
-- Changed SpawnFromVec2() method.
--- RandomizeUnits is used to randomize the start position of the Units in a defined radius band, through OuterRadius and InnerRadius parameters.
2016-08-08
- Added briefing to method ESCORT:New()