Merge pull request #246 from FlightControl-Master/master-bugfix

2017-02-08 - Reworked some vector functions.
-- POINT_VEC3:NewFromVec2( Vec2, LandHeightAdd ) added.
-- ZONE_RADIUS:GetRandomPointVec2( inner, outer ) added.
-- ZONE_RADIUS:GetRandomPointVec3( inner, outer ) added.
-- ZONE_POLYGON_BASE:GetRandomPointVec2() added.
-- ZONE_POLYGON_BASE:GetRandomPointVec3() added.
This commit is contained in:
Sven Van de Velde 2017-02-18 22:39:38 +01:00 committed by GitHub
commit e6e470e8d1
28 changed files with 1019 additions and 142 deletions

View File

@ -38,6 +38,8 @@
--
-- Hereby the change log:
--
-- 2017-02-18: POINT_VEC3:**NewFromVec2( Vec2, LandHeightAdd )** added.
--
-- 2016-08-12: POINT_VEC3:**Translate( Distance, Angle )** added.
--
-- 2016-08-06: Made PointVec3 and Vec3, PointVec2 and Vec2 terminology used in the code consistent.
@ -127,6 +129,24 @@ function POINT_VEC3:New( x, y, z )
return self
end
--- Create a new POINT_VEC3 object from Vec2 coordinates.
-- @param #POINT_VEC3 self
-- @param Dcs.DCSTypes#Vec2 Vec2 The Vec2 point.
-- @return Core.Point#POINT_VEC3 self
function POINT_VEC3:NewFromVec2( Vec2, LandHeightAdd )
local LandHeight = land.getHeight( Vec2 )
LandHeightAdd = LandHeightAdd or 0
LandHeight = LandHeight + LandHeightAdd
self = self:New( Vec2.x, LandHeight, Vec2.y )
self:F2( self )
return self
end
--- Create a new POINT_VEC3 object from Vec3 coordinates.
-- @param #POINT_VEC3 self
-- @param Dcs.DCSTypes#Vec3 Vec3 The Vec3 point.

View File

@ -1,4 +1,5 @@
--- This module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
--- This core module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
--
-- There are essentially two core functions that zones accomodate:
--
-- * Test if an object is within the zone boundaries.
@ -24,94 +25,111 @@
--
-- ===
--
-- 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
-- ================================================
-- # 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
--
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
-- ### 1.1) Each zone has a name:
-- ## 1.1) Each zone has a name:
--
-- * @{#ZONE_BASE.GetName}(): Returns the name of the zone.
--
-- ### 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
-- ## 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
--
-- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Point#POINT_VEC2} is within the zone.
-- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Point#POINT_VEC3} is within the zone.
--
-- ### 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
-- ## 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
--
-- * @{#ZONE_BASE.SetRandomizeProbability}(): Set the randomization probability of a zone to be selected, taking a value between 0 and 1 ( 0 = 0%, 1 = 100% )
-- * @{#ZONE_BASE.GetRandomizeProbability}(): Get the randomization probability of a zone to be selected, passing a value between 0 and 1 ( 0 = 0%, 1 = 100% )
-- * @{#ZONE_BASE.GetZoneMaybe}(): Get the zone taking into account the randomization probability. nil is returned if this zone is not a candidate.
--
-- ### 1.4) A zone manages Vectors:
-- ## 1.4) A zone manages Vectors:
--
-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} coordinate of the zone.
-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{DCSTypes#Vec2} within the zone.
--
-- ### 1.5) A zone has a bounding square:
-- ## 1.5) A zone has a bounding square:
--
-- * @{#ZONE_BASE.GetBoundingSquare}(): Get the outer most bounding square of the zone.
--
-- ### 1.6) A zone can be marked:
-- ## 1.6) A zone can be marked:
--
-- * @{#ZONE_BASE.SmokeZone}(): Smokes the zone boundaries in a color.
-- * @{#ZONE_BASE.FlareZone}(): Flares the zone boundaries in a color.
--
-- ===
--
-- 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
-- =======================================================
-- # 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
--
-- The ZONE_RADIUS class defined by a zone name, a location and a radius.
-- This class implements the inherited functions from Core.Zone#ZONE_BASE taking into account the own zone format and properties.
--
-- ### 2.1) @{Zone#ZONE_RADIUS} constructor:
-- ## 2.1) @{Zone#ZONE_RADIUS} constructor
--
-- * @{#ZONE_BASE.New}(): Constructor.
-- * @{#ZONE_RADIUS.New}(): Constructor.
--
-- ### 2.2) Manage the radius of the zone:
-- ## 2.2) Manage the radius of the zone
--
-- * @{#ZONE_BASE.SetRadius}(): Sets the radius of the zone.
-- * @{#ZONE_BASE.GetRadius}(): Returns the radius of the zone.
-- * @{#ZONE_RADIUS.SetRadius}(): Sets the radius of the zone.
-- * @{#ZONE_RADIUS.GetRadius}(): Returns the radius of the zone.
--
-- ### 2.3) Manage the location of the zone:
-- ## 2.3) Manage the location of the zone
--
-- * @{#ZONE_BASE.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_BASE.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
-- * @{#ZONE_RADIUS.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_RADIUS.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_RADIUS.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
--
-- ## 2.4) Zone point randomization
--
-- Various functions exist to find random points within the zone.
--
-- * @{#ZONE_RADIUS.GetRandomVec2}(): Gets a random 2D point in the zone.
-- * @{#ZONE_RADIUS.GetRandomPointVec2}(): Gets a @{Point#POINT_VEC2} object representing a random 2D point in the zone.
-- * @{#ZONE_RADIUS.GetRandomPointVec3}(): Gets a @{Point#POINT_VEC3} object representing a random 3D point in the zone. Note that the height of the point is at landheight.
--
-- ===
--
-- 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
-- ==========================================
-- # 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
--
-- The ZONE class, defined by the zone name as defined within the Mission Editor.
-- This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
-- 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
-- # 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
--
-- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
-- 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
-- # 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
--
-- The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
-- 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
-- ========================================================
-- # 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
--
-- The ZONE_POLYGON_BASE class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
-- ## 6.1) Zone point randomization
--
-- Various functions exist to find random points within the zone.
--
-- * @{#ZONE_POLYGON_BASE.GetRandomVec2}(): Gets a random 2D point in the zone.
-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec2}(): Return a @{Point#POINT_VEC2} object representing a random 2D point within the zone.
-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec3}(): Return a @{Point#POINT_VEC3} object representing a random 3D point at landheight within the zone.
--
--
-- ===
--
-- 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
-- ================================================================
-- # 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
--
-- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
@ -127,6 +145,14 @@
--
-- Hereby the change log:
--
-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec2()** added.
--
-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec3()** added.
--
-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec3( inner, outer )** added.
--
-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec2( inner, outer )** added.
--
-- 2016-08-15: ZONE_BASE:**GetName()** added.
--
-- 2016-08-15: ZONE_BASE:**SetZoneProbability( ZoneProbability )** added.
@ -212,6 +238,7 @@ function ZONE_BASE:GetVec2()
return nil
end
--- Define a random @{DCSTypes#Vec2} within the zone.
-- @param #ZONE_BASE self
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinates.
@ -219,6 +246,13 @@ function ZONE_BASE:GetRandomVec2()
return nil
end
--- Define a random @{Point#POINT_VEC2} within the zone.
-- @param #ZONE_BASE self
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
function ZONE_BASE:GetRandomPointVec2()
return nil
end
--- Get the bounding square the zone.
-- @param #ZONE_BASE self
-- @return #nil The bounding square.
@ -447,12 +481,12 @@ function ZONE_RADIUS:IsPointVec3InZone( Vec3 )
return InZone
end
--- Returns a random location within the zone.
--- Returns a random Vec2 location within the zone.
-- @param #ZONE_RADIUS self
-- @param #number inner minimal distance from the center of the zone
-- @param #number outer minimal distance from the outer edge of the zone
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return Dcs.DCSTypes#Vec2 The random location within the zone.
function ZONE_RADIUS:GetRandomVec2(inner, outer)
function ZONE_RADIUS:GetRandomVec2( inner, outer )
self:F( self.ZoneName, inner, outer )
local Point = {}
@ -469,6 +503,36 @@ function ZONE_RADIUS:GetRandomVec2(inner, outer)
return Point
end
--- Returns a @{Point#POINT_VEC2} object reflecting a random 2D location within the zone.
-- @param #ZONE_RADIUS self
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return Core.Point#POINT_VEC2 The @{Point#POINT_VEC2} object reflecting the random 3D location within the zone.
function ZONE_RADIUS:GetRandomPointVec2( inner, outer )
self:F( self.ZoneName, inner, outer )
local PointVec2 = POINT_VEC2:NewFromVec2( self:GetRandomVec2() )
self:T3( { PointVec2 } )
return PointVec2
end
--- Returns a @{Point#POINT_VEC3} object reflecting a random 3D location within the zone.
-- @param #ZONE_RADIUS self
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return Core.Point#POINT_VEC3 The @{Point#POINT_VEC3} object reflecting the random 3D location within the zone.
function ZONE_RADIUS:GetRandomPointVec3( inner, outer )
self:F( self.ZoneName, inner, outer )
local PointVec3 = POINT_VEC3:NewFromVec2( self:GetRandomVec2() )
self:T3( { PointVec3 } )
return PointVec3
end
--- The ZONE class, defined by the zone name as defined within the Mission Editor. The location and the radius are automatically collected from the mission settings.
@ -783,6 +847,33 @@ function ZONE_POLYGON_BASE:GetRandomVec2()
return Vec2
end
--- Return a @{Point#POINT_VEC2} object representing a random 2D point at landheight within the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return @{Point#POINT_VEC2}
function ZONE_POLYGON_BASE:GetRandomPointVec2()
self:F2()
local PointVec2 = POINT_VEC2:NewFromVec2( self:GetRandomVec2() )
self:T2( PointVec2 )
return PointVec2
end
--- Return a @{Point#POINT_VEC3} object representing a random 3D point at landheight within the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return @{Point#POINT_VEC3}
function ZONE_POLYGON_BASE:GetRandomPointVec3()
self:F2()
local PointVec3 = POINT_VEC3:NewFromVec2( self:GetRandomVec2() )
self:T2( PointVec3 )
return PointVec3
end
--- Get the bounding square the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return #ZONE_POLYGON_BASE.BoundingSquare The bounding square.

View File

@ -1,3 +1,14 @@
2017-02-08
- Reworked some vector functions.
-- POINT_VEC3:NewFromVec2( Vec2, LandHeightAdd ) added.
-- ZONE_RADIUS:GetRandomPointVec2( inner, outer ) added.
-- ZONE_RADIUS:GetRandomPointVec3( inner, outer ) added.
-- ZONE_POLYGON_BASE:GetRandomPointVec2() added.
-- ZONE_POLYGON_BASE:GetRandomPointVec3() added.
2016-12-06
- Renamed the documentation references following the structure of the files.

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170214_1649' )
env.info( 'Moose Generation Timestamp: 20170218_2236' )
local base = _G
Include = {}
@ -6069,7 +6069,8 @@ do
end
--- This module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
--- This core module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
--
-- There are essentially two core functions that zones accomodate:
--
-- * Test if an object is within the zone boundaries.
@ -6095,94 +6096,111 @@ end
--
-- ===
--
-- 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
-- ================================================
-- # 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
--
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
-- ### 1.1) Each zone has a name:
-- ## 1.1) Each zone has a name:
--
-- * @{#ZONE_BASE.GetName}(): Returns the name of the zone.
--
-- ### 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
-- ## 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
--
-- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Point#POINT_VEC2} is within the zone.
-- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Point#POINT_VEC3} is within the zone.
--
-- ### 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
-- ## 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
--
-- * @{#ZONE_BASE.SetRandomizeProbability}(): Set the randomization probability of a zone to be selected, taking a value between 0 and 1 ( 0 = 0%, 1 = 100% )
-- * @{#ZONE_BASE.GetRandomizeProbability}(): Get the randomization probability of a zone to be selected, passing a value between 0 and 1 ( 0 = 0%, 1 = 100% )
-- * @{#ZONE_BASE.GetZoneMaybe}(): Get the zone taking into account the randomization probability. nil is returned if this zone is not a candidate.
--
-- ### 1.4) A zone manages Vectors:
-- ## 1.4) A zone manages Vectors:
--
-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} coordinate of the zone.
-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{DCSTypes#Vec2} within the zone.
--
-- ### 1.5) A zone has a bounding square:
-- ## 1.5) A zone has a bounding square:
--
-- * @{#ZONE_BASE.GetBoundingSquare}(): Get the outer most bounding square of the zone.
--
-- ### 1.6) A zone can be marked:
-- ## 1.6) A zone can be marked:
--
-- * @{#ZONE_BASE.SmokeZone}(): Smokes the zone boundaries in a color.
-- * @{#ZONE_BASE.FlareZone}(): Flares the zone boundaries in a color.
--
-- ===
--
-- 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
-- =======================================================
-- # 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
--
-- The ZONE_RADIUS class defined by a zone name, a location and a radius.
-- This class implements the inherited functions from Core.Zone#ZONE_BASE taking into account the own zone format and properties.
--
-- ### 2.1) @{Zone#ZONE_RADIUS} constructor:
-- ## 2.1) @{Zone#ZONE_RADIUS} constructor
--
-- * @{#ZONE_BASE.New}(): Constructor.
-- * @{#ZONE_RADIUS.New}(): Constructor.
--
-- ### 2.2) Manage the radius of the zone:
-- ## 2.2) Manage the radius of the zone
--
-- * @{#ZONE_BASE.SetRadius}(): Sets the radius of the zone.
-- * @{#ZONE_BASE.GetRadius}(): Returns the radius of the zone.
-- * @{#ZONE_RADIUS.SetRadius}(): Sets the radius of the zone.
-- * @{#ZONE_RADIUS.GetRadius}(): Returns the radius of the zone.
--
-- ### 2.3) Manage the location of the zone:
-- ## 2.3) Manage the location of the zone
--
-- * @{#ZONE_BASE.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_BASE.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
-- * @{#ZONE_RADIUS.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_RADIUS.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_RADIUS.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
--
-- ## 2.4) Zone point randomization
--
-- Various functions exist to find random points within the zone.
--
-- * @{#ZONE_RADIUS.GetRandomVec2}(): Gets a random 2D point in the zone.
-- * @{#ZONE_RADIUS.GetRandomPointVec2}(): Gets a @{Point#POINT_VEC2} object representing a random 2D point in the zone.
-- * @{#ZONE_RADIUS.GetRandomPointVec3}(): Gets a @{Point#POINT_VEC3} object representing a random 3D point in the zone. Note that the height of the point is at landheight.
--
-- ===
--
-- 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
-- ==========================================
-- # 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
--
-- The ZONE class, defined by the zone name as defined within the Mission Editor.
-- This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
-- 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
-- # 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
--
-- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
-- 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
-- # 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
--
-- The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
-- 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
-- ========================================================
-- # 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
--
-- The ZONE_POLYGON_BASE class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
-- ## 6.1) Zone point randomization
--
-- Various functions exist to find random points within the zone.
--
-- * @{#ZONE_POLYGON_BASE.GetRandomVec2}(): Gets a random 2D point in the zone.
-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec2}(): Return a @{Point#POINT_VEC2} object representing a random 2D point within the zone.
-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec3}(): Return a @{Point#POINT_VEC3} object representing a random 3D point at landheight within the zone.
--
--
-- ===
--
-- 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
-- ================================================================
-- # 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
--
-- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
@ -6198,6 +6216,14 @@ end
--
-- Hereby the change log:
--
-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec2()** added.
--
-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec3()** added.
--
-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec3( inner, outer )** added.
--
-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec2( inner, outer )** added.
--
-- 2016-08-15: ZONE_BASE:**GetName()** added.
--
-- 2016-08-15: ZONE_BASE:**SetZoneProbability( ZoneProbability )** added.
@ -6283,6 +6309,7 @@ function ZONE_BASE:GetVec2()
return nil
end
--- Define a random @{DCSTypes#Vec2} within the zone.
-- @param #ZONE_BASE self
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinates.
@ -6290,6 +6317,13 @@ function ZONE_BASE:GetRandomVec2()
return nil
end
--- Define a random @{Point#POINT_VEC2} within the zone.
-- @param #ZONE_BASE self
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
function ZONE_BASE:GetRandomPointVec2()
return nil
end
--- Get the bounding square the zone.
-- @param #ZONE_BASE self
-- @return #nil The bounding square.
@ -6518,12 +6552,12 @@ function ZONE_RADIUS:IsPointVec3InZone( Vec3 )
return InZone
end
--- Returns a random location within the zone.
--- Returns a random Vec2 location within the zone.
-- @param #ZONE_RADIUS self
-- @param #number inner minimal distance from the center of the zone
-- @param #number outer minimal distance from the outer edge of the zone
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return Dcs.DCSTypes#Vec2 The random location within the zone.
function ZONE_RADIUS:GetRandomVec2(inner, outer)
function ZONE_RADIUS:GetRandomVec2( inner, outer )
self:F( self.ZoneName, inner, outer )
local Point = {}
@ -6540,6 +6574,36 @@ function ZONE_RADIUS:GetRandomVec2(inner, outer)
return Point
end
--- Returns a @{Point#POINT_VEC2} object reflecting a random 2D location within the zone.
-- @param #ZONE_RADIUS self
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return Core.Point#POINT_VEC2 The @{Point#POINT_VEC2} object reflecting the random 3D location within the zone.
function ZONE_RADIUS:GetRandomPointVec2( inner, outer )
self:F( self.ZoneName, inner, outer )
local PointVec2 = POINT_VEC2:NewFromVec2( self:GetRandomVec2() )
self:T3( { PointVec2 } )
return PointVec2
end
--- Returns a @{Point#POINT_VEC3} object reflecting a random 3D location within the zone.
-- @param #ZONE_RADIUS self
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return Core.Point#POINT_VEC3 The @{Point#POINT_VEC3} object reflecting the random 3D location within the zone.
function ZONE_RADIUS:GetRandomPointVec3( inner, outer )
self:F( self.ZoneName, inner, outer )
local PointVec3 = POINT_VEC3:NewFromVec2( self:GetRandomVec2() )
self:T3( { PointVec3 } )
return PointVec3
end
--- The ZONE class, defined by the zone name as defined within the Mission Editor. The location and the radius are automatically collected from the mission settings.
@ -6854,6 +6918,33 @@ function ZONE_POLYGON_BASE:GetRandomVec2()
return Vec2
end
--- Return a @{Point#POINT_VEC2} object representing a random 2D point at landheight within the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return @{Point#POINT_VEC2}
function ZONE_POLYGON_BASE:GetRandomPointVec2()
self:F2()
local PointVec2 = POINT_VEC2:NewFromVec2( self:GetRandomVec2() )
self:T2( PointVec2 )
return PointVec2
end
--- Return a @{Point#POINT_VEC3} object representing a random 3D point at landheight within the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return @{Point#POINT_VEC3}
function ZONE_POLYGON_BASE:GetRandomPointVec3()
self:F2()
local PointVec3 = POINT_VEC3:NewFromVec2( self:GetRandomVec2() )
self:T2( PointVec3 )
return PointVec3
end
--- Get the bounding square the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return #ZONE_POLYGON_BASE.BoundingSquare The bounding square.
@ -10013,6 +10104,8 @@ end
--
-- Hereby the change log:
--
-- 2017-02-18: POINT_VEC3:**NewFromVec2( Vec2, LandHeightAdd )** added.
--
-- 2016-08-12: POINT_VEC3:**Translate( Distance, Angle )** added.
--
-- 2016-08-06: Made PointVec3 and Vec3, PointVec2 and Vec2 terminology used in the code consistent.
@ -10102,6 +10195,24 @@ function POINT_VEC3:New( x, y, z )
return self
end
--- Create a new POINT_VEC3 object from Vec2 coordinates.
-- @param #POINT_VEC3 self
-- @param Dcs.DCSTypes#Vec2 Vec2 The Vec2 point.
-- @return Core.Point#POINT_VEC3 self
function POINT_VEC3:NewFromVec2( Vec2, LandHeightAdd )
local LandHeight = land.getHeight( Vec2 )
LandHeightAdd = LandHeightAdd or 0
LandHeight = LandHeight + LandHeightAdd
self = self:New( Vec2.x, LandHeight, Vec2.y )
self:F2( self )
return self
end
--- Create a new POINT_VEC3 object from Vec3 coordinates.
-- @param #POINT_VEC3 self
-- @param Dcs.DCSTypes#Vec3 Vec3 The Vec3 point.
@ -22292,9 +22403,8 @@ function MISSILETRAINER:_EventShot( Event )
end
else
-- TODO: some weapons don't know the target unit... Need to develop a workaround for this.
SCHEDULER:New( TrainerWeapon, TrainerWeapon.destroy, {}, 2 )
if ( TrainerWeapon:getTypeName() == "9M311" ) then
SCHEDULER:New( TrainerWeapon, TrainerWeapon.destroy, {}, 2 )
if ( TrainerWeapon:getTypeName() == "9M311" ) then
SCHEDULER:New( TrainerWeapon, TrainerWeapon.destroy, {}, 1 )
else
end
end

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170214_1649' )
env.info( 'Moose Generation Timestamp: 20170218_2236' )
local base = _G
Include = {}
@ -6069,7 +6069,8 @@ do
end
--- This module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
--- This core module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
--
-- There are essentially two core functions that zones accomodate:
--
-- * Test if an object is within the zone boundaries.
@ -6095,94 +6096,111 @@ end
--
-- ===
--
-- 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
-- ================================================
-- # 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
--
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
-- ### 1.1) Each zone has a name:
-- ## 1.1) Each zone has a name:
--
-- * @{#ZONE_BASE.GetName}(): Returns the name of the zone.
--
-- ### 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
-- ## 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
--
-- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Point#POINT_VEC2} is within the zone.
-- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Point#POINT_VEC3} is within the zone.
--
-- ### 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
-- ## 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
--
-- * @{#ZONE_BASE.SetRandomizeProbability}(): Set the randomization probability of a zone to be selected, taking a value between 0 and 1 ( 0 = 0%, 1 = 100% )
-- * @{#ZONE_BASE.GetRandomizeProbability}(): Get the randomization probability of a zone to be selected, passing a value between 0 and 1 ( 0 = 0%, 1 = 100% )
-- * @{#ZONE_BASE.GetZoneMaybe}(): Get the zone taking into account the randomization probability. nil is returned if this zone is not a candidate.
--
-- ### 1.4) A zone manages Vectors:
-- ## 1.4) A zone manages Vectors:
--
-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} coordinate of the zone.
-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{DCSTypes#Vec2} within the zone.
--
-- ### 1.5) A zone has a bounding square:
-- ## 1.5) A zone has a bounding square:
--
-- * @{#ZONE_BASE.GetBoundingSquare}(): Get the outer most bounding square of the zone.
--
-- ### 1.6) A zone can be marked:
-- ## 1.6) A zone can be marked:
--
-- * @{#ZONE_BASE.SmokeZone}(): Smokes the zone boundaries in a color.
-- * @{#ZONE_BASE.FlareZone}(): Flares the zone boundaries in a color.
--
-- ===
--
-- 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
-- =======================================================
-- # 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
--
-- The ZONE_RADIUS class defined by a zone name, a location and a radius.
-- This class implements the inherited functions from Core.Zone#ZONE_BASE taking into account the own zone format and properties.
--
-- ### 2.1) @{Zone#ZONE_RADIUS} constructor:
-- ## 2.1) @{Zone#ZONE_RADIUS} constructor
--
-- * @{#ZONE_BASE.New}(): Constructor.
-- * @{#ZONE_RADIUS.New}(): Constructor.
--
-- ### 2.2) Manage the radius of the zone:
-- ## 2.2) Manage the radius of the zone
--
-- * @{#ZONE_BASE.SetRadius}(): Sets the radius of the zone.
-- * @{#ZONE_BASE.GetRadius}(): Returns the radius of the zone.
-- * @{#ZONE_RADIUS.SetRadius}(): Sets the radius of the zone.
-- * @{#ZONE_RADIUS.GetRadius}(): Returns the radius of the zone.
--
-- ### 2.3) Manage the location of the zone:
-- ## 2.3) Manage the location of the zone
--
-- * @{#ZONE_BASE.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_BASE.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
-- * @{#ZONE_RADIUS.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_RADIUS.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
-- * @{#ZONE_RADIUS.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
--
-- ## 2.4) Zone point randomization
--
-- Various functions exist to find random points within the zone.
--
-- * @{#ZONE_RADIUS.GetRandomVec2}(): Gets a random 2D point in the zone.
-- * @{#ZONE_RADIUS.GetRandomPointVec2}(): Gets a @{Point#POINT_VEC2} object representing a random 2D point in the zone.
-- * @{#ZONE_RADIUS.GetRandomPointVec3}(): Gets a @{Point#POINT_VEC3} object representing a random 3D point in the zone. Note that the height of the point is at landheight.
--
-- ===
--
-- 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
-- ==========================================
-- # 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
--
-- The ZONE class, defined by the zone name as defined within the Mission Editor.
-- This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
-- 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
-- # 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
--
-- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
-- 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
-- # 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
--
-- The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
-- 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
-- ========================================================
-- # 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
--
-- The ZONE_POLYGON_BASE class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
-- ## 6.1) Zone point randomization
--
-- Various functions exist to find random points within the zone.
--
-- * @{#ZONE_POLYGON_BASE.GetRandomVec2}(): Gets a random 2D point in the zone.
-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec2}(): Return a @{Point#POINT_VEC2} object representing a random 2D point within the zone.
-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec3}(): Return a @{Point#POINT_VEC3} object representing a random 3D point at landheight within the zone.
--
--
-- ===
--
-- 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
-- ================================================================
-- # 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
--
-- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
@ -6198,6 +6216,14 @@ end
--
-- Hereby the change log:
--
-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec2()** added.
--
-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec3()** added.
--
-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec3( inner, outer )** added.
--
-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec2( inner, outer )** added.
--
-- 2016-08-15: ZONE_BASE:**GetName()** added.
--
-- 2016-08-15: ZONE_BASE:**SetZoneProbability( ZoneProbability )** added.
@ -6283,6 +6309,7 @@ function ZONE_BASE:GetVec2()
return nil
end
--- Define a random @{DCSTypes#Vec2} within the zone.
-- @param #ZONE_BASE self
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinates.
@ -6290,6 +6317,13 @@ function ZONE_BASE:GetRandomVec2()
return nil
end
--- Define a random @{Point#POINT_VEC2} within the zone.
-- @param #ZONE_BASE self
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
function ZONE_BASE:GetRandomPointVec2()
return nil
end
--- Get the bounding square the zone.
-- @param #ZONE_BASE self
-- @return #nil The bounding square.
@ -6518,12 +6552,12 @@ function ZONE_RADIUS:IsPointVec3InZone( Vec3 )
return InZone
end
--- Returns a random location within the zone.
--- Returns a random Vec2 location within the zone.
-- @param #ZONE_RADIUS self
-- @param #number inner minimal distance from the center of the zone
-- @param #number outer minimal distance from the outer edge of the zone
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return Dcs.DCSTypes#Vec2 The random location within the zone.
function ZONE_RADIUS:GetRandomVec2(inner, outer)
function ZONE_RADIUS:GetRandomVec2( inner, outer )
self:F( self.ZoneName, inner, outer )
local Point = {}
@ -6540,6 +6574,36 @@ function ZONE_RADIUS:GetRandomVec2(inner, outer)
return Point
end
--- Returns a @{Point#POINT_VEC2} object reflecting a random 2D location within the zone.
-- @param #ZONE_RADIUS self
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return Core.Point#POINT_VEC2 The @{Point#POINT_VEC2} object reflecting the random 3D location within the zone.
function ZONE_RADIUS:GetRandomPointVec2( inner, outer )
self:F( self.ZoneName, inner, outer )
local PointVec2 = POINT_VEC2:NewFromVec2( self:GetRandomVec2() )
self:T3( { PointVec2 } )
return PointVec2
end
--- Returns a @{Point#POINT_VEC3} object reflecting a random 3D location within the zone.
-- @param #ZONE_RADIUS self
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return Core.Point#POINT_VEC3 The @{Point#POINT_VEC3} object reflecting the random 3D location within the zone.
function ZONE_RADIUS:GetRandomPointVec3( inner, outer )
self:F( self.ZoneName, inner, outer )
local PointVec3 = POINT_VEC3:NewFromVec2( self:GetRandomVec2() )
self:T3( { PointVec3 } )
return PointVec3
end
--- The ZONE class, defined by the zone name as defined within the Mission Editor. The location and the radius are automatically collected from the mission settings.
@ -6854,6 +6918,33 @@ function ZONE_POLYGON_BASE:GetRandomVec2()
return Vec2
end
--- Return a @{Point#POINT_VEC2} object representing a random 2D point at landheight within the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return @{Point#POINT_VEC2}
function ZONE_POLYGON_BASE:GetRandomPointVec2()
self:F2()
local PointVec2 = POINT_VEC2:NewFromVec2( self:GetRandomVec2() )
self:T2( PointVec2 )
return PointVec2
end
--- Return a @{Point#POINT_VEC3} object representing a random 3D point at landheight within the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return @{Point#POINT_VEC3}
function ZONE_POLYGON_BASE:GetRandomPointVec3()
self:F2()
local PointVec3 = POINT_VEC3:NewFromVec2( self:GetRandomVec2() )
self:T2( PointVec3 )
return PointVec3
end
--- Get the bounding square the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return #ZONE_POLYGON_BASE.BoundingSquare The bounding square.
@ -10013,6 +10104,8 @@ end
--
-- Hereby the change log:
--
-- 2017-02-18: POINT_VEC3:**NewFromVec2( Vec2, LandHeightAdd )** added.
--
-- 2016-08-12: POINT_VEC3:**Translate( Distance, Angle )** added.
--
-- 2016-08-06: Made PointVec3 and Vec3, PointVec2 and Vec2 terminology used in the code consistent.
@ -10102,6 +10195,24 @@ function POINT_VEC3:New( x, y, z )
return self
end
--- Create a new POINT_VEC3 object from Vec2 coordinates.
-- @param #POINT_VEC3 self
-- @param Dcs.DCSTypes#Vec2 Vec2 The Vec2 point.
-- @return Core.Point#POINT_VEC3 self
function POINT_VEC3:NewFromVec2( Vec2, LandHeightAdd )
local LandHeight = land.getHeight( Vec2 )
LandHeightAdd = LandHeightAdd or 0
LandHeight = LandHeight + LandHeightAdd
self = self:New( Vec2.x, LandHeight, Vec2.y )
self:F2( self )
return self
end
--- Create a new POINT_VEC3 object from Vec3 coordinates.
-- @param #POINT_VEC3 self
-- @param Dcs.DCSTypes#Vec3 Vec3 The Vec3 point.

View File

@ -0,0 +1,43 @@
---
-- Name: ZON-101 - Normal Zone - Random Point
-- Author: FlightControl
-- Date Created: 18 Feb 2017
--
-- # Situation:
--
-- Three zones are defined.
-- 15 points are smoked in each zone.
-- The first 15 points are blue smoked using the GetRandomVec2() API.
-- The second 15 points are orange smoked using the GetRandomPointVec2() API.
-- The third 15 points are red smoked using the GetRandomPointVec3() API.
-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement.
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view.
--
-- # Test cases:
--
-- 1. Observe smoking of Blue smoke in Zone 1.
-- 2. Observe smoking of Orange smoke in Zone 2.
-- 3. Observe smoking of Red smoke in Zone 3.
local Zone1 = ZONE:New( "Zone 1" )
local Zone2 = ZONE:New( "Zone 2" )
local Zone3 = ZONE:New( "Zone 3" )
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
for i = 1, 15 do
-- Zone 1
local Vec2 = Zone1:GetRandomVec2()
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
PointVec2:SmokeBlue()
-- Zone 2
local PointVec2 = Zone2:GetRandomPointVec2()
PointVec2:SmokeOrange()
-- Zone 3
local PointVec3 = Zone3:GetRandomPointVec3()
PointVec3:SmokeRed()
end

View File

@ -0,0 +1,43 @@
---
-- Name: ZON-201 - Group Zone - Random Point
-- Author: FlightControl
-- Date Created: 18 Feb 2017
--
-- # Situation:
--
-- Three zones are defined.
-- 15 points are smoked in each zone.
-- The first 15 points are blue smoked using the GetRandomVec2() API.
-- The second 15 points are orange smoked using the GetRandomPointVec2() API.
-- The third 15 points are red smoked using the GetRandomPointVec3() API.
-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement.
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view.
--
-- # Test cases:
--
-- 1. Observe smoking of Blue smoke in Zone 1.
-- 2. Observe smoking of Orange smoke in Zone 2.
-- 3. Observe smoking of Red smoke in Zone 3.
local Zone1 = ZONE_GROUP:New( "Zone 1", GROUP:FindByName( "Zone 1" ), 300 )
local Zone2 = ZONE_GROUP:New( "Zone 2", GROUP:FindByName( "Zone 2" ), 300 )
local Zone3 = ZONE_GROUP:New( "Zone 3", GROUP:FindByName( "Zone 3" ), 300 )
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
for i = 1, 15 do
-- Zone 1
local Vec2 = Zone1:GetRandomVec2()
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
PointVec2:SmokeBlue()
-- Zone 2
local PointVec2 = Zone2:GetRandomPointVec2()
PointVec2:SmokeOrange()
-- Zone 3
local PointVec3 = Zone3:GetRandomPointVec3()
PointVec3:SmokeRed()
end

View File

@ -0,0 +1,43 @@
---
-- Name: ZON-301 - Unit Zone - Random Point
-- Author: FlightControl
-- Date Created: 18 Feb 2017
--
-- # Situation:
--
-- Three zones are defined.
-- 15 points are smoked in each zone.
-- The first 15 points are blue smoked using the GetRandomVec2() API.
-- The second 15 points are orange smoked using the GetRandomPointVec2() API.
-- The third 15 points are red smoked using the GetRandomPointVec3() API.
-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement.
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view.
--
-- # Test cases:
--
-- 1. Observe smoking of Blue smoke in Zone 1.
-- 2. Observe smoking of Orange smoke in Zone 2.
-- 3. Observe smoking of Red smoke in Zone 3.
local Zone1 = ZONE_UNIT:New( "Zone 1", UNIT:FindByName( "Zone 1" ), 300 )
local Zone2 = ZONE_UNIT:New( "Zone 2", UNIT:FindByName( "Zone 2" ), 300 )
local Zone3 = ZONE_UNIT:New( "Zone 3", UNIT:FindByName( "Zone 3" ), 300 )
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
for i = 1, 15 do
-- Zone 1
local Vec2 = Zone1:GetRandomVec2()
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
PointVec2:SmokeBlue()
-- Zone 2
local PointVec2 = Zone2:GetRandomPointVec2()
PointVec2:SmokeOrange()
-- Zone 3
local PointVec3 = Zone3:GetRandomPointVec3()
PointVec3:SmokeRed()
end

View File

@ -0,0 +1,48 @@
---
-- Name: ZON-401 - Radius Zone - Random Point
-- Author: FlightControl
-- Date Created: 18 Feb 2017
--
-- # Situation:
--
-- Three zones are defined.
-- 15 points are smoked in each zone.
-- The first 15 points are blue smoked using the GetRandomVec2() API.
-- The second 15 points are orange smoked using the GetRandomPointVec2() API.
-- The third 15 points are red smoked using the GetRandomPointVec3() API.
-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement.
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view.
--
-- # Test cases:
--
-- 1. Observe smoking of Blue smoke in Zone 1.
-- 2. Observe smoking of Orange smoke in Zone 2.
-- 3. Observe smoking of Red smoke in Zone 3.
local Unit1 = UNIT:FindByName( "Zone 1" )
local Unit2 = UNIT:FindByName( "Zone 2" )
local Unit3 = UNIT:FindByName( "Zone 3" )
local Zone1 = ZONE_RADIUS:New( "Zone 1", Unit1:GetVec2(), 300 )
local Zone2 = ZONE_RADIUS:New( "Zone 2", Unit2:GetVec2(), 300 )
local Zone3 = ZONE_RADIUS:New( "Zone 3", Unit3:GetVec2(), 300 )
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
for i = 1, 15 do
-- Zone 1
local Vec2 = Zone1:GetRandomVec2()
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
PointVec2:SmokeBlue()
-- Zone 2
local PointVec2 = Zone2:GetRandomPointVec2()
PointVec2:SmokeOrange()
-- Zone 3
local PointVec3 = Zone3:GetRandomPointVec3()
PointVec3:SmokeRed()
end

View File

@ -0,0 +1,43 @@
---
-- Name: ZON-501 - Polygon Zone - Random Point
-- Author: FlightControl
-- Date Created: 18 Feb 2017
--
-- # Situation:
--
-- Three zones are defined.
-- 15 points are smoked in each zone.
-- The first 15 points are blue smoked using the GetRandomVec2() API.
-- The second 15 points are orange smoked using the GetRandomPointVec2() API.
-- The third 15 points are red smoked using the GetRandomPointVec3() API.
-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement.
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view.
--
-- # Test cases:
--
-- 1. Observe smoking of Blue smoke in Zone 1.
-- 2. Observe smoking of Orange smoke in Zone 2.
-- 3. Observe smoking of Red smoke in Zone 3.
local Zone1 = ZONE_POLYGON:New( "Zone 1", GROUP:FindByName( "Zone 1" ) )
local Zone2 = ZONE_POLYGON:New( "Zone 2", GROUP:FindByName( "Zone 2" ) )
local Zone3 = ZONE_POLYGON:New( "Zone 3", GROUP:FindByName( "Zone 3" ) )
Zone1:SmokeZone( SMOKECOLOR.White, 4 )
Zone2:SmokeZone( SMOKECOLOR.White, 4 )
Zone3:SmokeZone( SMOKECOLOR.White, 4 )
for i = 1, 15 do
-- Zone 1
local Vec2 = Zone1:GetRandomVec2()
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
PointVec2:SmokeBlue()
-- Zone 2
local PointVec2 = Zone2:GetRandomPointVec2()
PointVec2:SmokeOrange()
-- Zone 3
local PointVec3 = Zone3:GetRandomPointVec3()
PointVec3:SmokeRed()
end

View File

@ -880,9 +880,6 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
<p> This table contains the targets detected during patrol.</p>
</dd>
</dl>
<dl class="function">

View File

@ -245,6 +245,12 @@ YYYY-MM-DD: CLASS:<strong>NewFunction( Params )</strong> added</p>
<td class="name" nowrap="nowrap"><a href="#EVENT">EVENT</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="#EVENTHANDLER">EVENTHANDLER</a></td>
<td class="summary">
</td>
</tr>
<tr>
@ -682,6 +688,28 @@ YYYY-MM-DD: CLASS:<strong>NewFunction( Params )</strong> added</p>
<td class="name" nowrap="nowrap"><a href="##(EVENTDATA).weapon">EVENTDATA.weapon</a></td>
<td class="summary">
</td>
</tr>
</table>
<h2><a id="#(EVENTHANDLER)">Type <code>EVENTHANDLER</code></a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENTHANDLER).ClassID">EVENTHANDLER.ClassID</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENTHANDLER).ClassName">EVENTHANDLER.ClassName</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENTHANDLER).New">EVENTHANDLER:New()</a></td>
<td class="summary">
<p>The EVENTHANDLER constructor</p>
</td>
</tr>
</table>
@ -841,6 +869,20 @@ YYYY-MM-DD: CLASS:<strong>NewFunction( Params )</strong> added</p>
</dd>
</dl>
<dl class="function">
<dt>
<em><a href="##(EVENTHANDLER)">#EVENTHANDLER</a></em>
<a id="EVENTHANDLER" >
<strong>EVENTHANDLER</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
@ -2662,6 +2704,58 @@ The self instance of the class for which the event is.</p>
</dd>
</dl>
<h2><a id="#(EVENTHANDLER)" >Type <code>EVENTHANDLER</code></a></h2>
<p>The EVENTHANDLER structure</p>
<h3>Field(s)</h3>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(EVENTHANDLER).ClassID" >
<strong>EVENTHANDLER.ClassID</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<em>#string</em>
<a id="#(EVENTHANDLER).ClassName" >
<strong>EVENTHANDLER.ClassName</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENTHANDLER).New" >
<strong>EVENTHANDLER:New()</strong>
</a>
</dt>
<dd>
<p>The EVENTHANDLER constructor</p>
<h3>Return value</h3>
<p><em><a href="##(EVENTHANDLER)">#EVENTHANDLER</a>:</em></p>
</dd>
</dl>

View File

@ -1505,7 +1505,7 @@ A string defining the start state.</p>
<dl class="function">
<dt>
<em></em>
<em>#string</em>
<a id="#(FSM)._StartState" >
<strong>FSM._StartState</strong>
</a>
@ -1804,7 +1804,6 @@ A string defining the start state.</p>
<dl class="function">
<dt>
<em></em>
<a id="#(FSM).current" >
<strong>FSM.current</strong>
</a>

View File

@ -114,6 +114,8 @@ In order to keep the credibility of the the author, I want to emphasize that the
<p>Hereby the change log:</p>
<p>2017-02-18: POINT_VEC3:<strong>NewFromVec2( Vec2, LandHeightAdd )</strong> added.</p>
<p>2016-08-12: POINT_VEC3:<strong>Translate( Distance, Angle )</strong> added.</p>
<p>2016-08-06: Made PointVec3 and Vec3, PointVec2 and Vec2 terminology used in the code consistent.</p>
@ -399,6 +401,12 @@ In order to keep the credibility of the the author, I want to emphasize that the
<td class="name" nowrap="nowrap"><a href="##(POINT_VEC3).New">POINT_VEC3:New(x, y, z)</a></td>
<td class="summary">
<p>Create a new POINT_VEC3 object.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(POINT_VEC3).NewFromVec2">POINT_VEC3:NewFromVec2(Vec2, LandHeightAdd)</a></td>
<td class="summary">
<p>Create a new POINT_VEC3 object from Vec2 coordinates.</p>
</td>
</tr>
<tr>
@ -1599,6 +1607,38 @@ self</p>
<dl class="function">
<dt>
<a id="#(POINT_VEC3).NewFromVec2" >
<strong>POINT_VEC3:NewFromVec2(Vec2, LandHeightAdd)</strong>
</a>
</dt>
<dd>
<p>Create a new POINT_VEC3 object from Vec2 coordinates.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Dcs.DCSTypes.html##(Vec2)">Dcs.DCSTypes#Vec2</a> Vec2 </em></code>:
The Vec2 point.</p>
</li>
<li>
<p><code><em> LandHeightAdd </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="Core.Point.html##(POINT_VEC3)">Core.Point#POINT_VEC3</a>:</em>
self</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(POINT_VEC3).NewFromVec3" >
<strong>POINT_VEC3:NewFromVec3(Vec3)</strong>
</a>

View File

@ -1758,9 +1758,6 @@ The group that was spawned. You can use this group for further actions.</p>
<p> Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.</p>
</dd>
</dl>
<dl class="function">
@ -2235,7 +2232,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(SPAWN).SpawnMaxGroups" >
<strong>SPAWN.SpawnMaxGroups</strong>
</a>
@ -2252,7 +2249,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(SPAWN).SpawnMaxUnitsAlive" >
<strong>SPAWN.SpawnMaxUnitsAlive</strong>
</a>
@ -2531,7 +2528,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
<dl class="function">
<dt>
<em>#boolean</em>
<em></em>
<a id="#(SPAWN).SpawnUnControlled" >
<strong>SPAWN.SpawnUnControlled</strong>
</a>
@ -2555,7 +2552,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
<p> When the first Spawn executes, all the Groups need to be made visible before start.</p>
<p> Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.</p>
</dd>
</dl>

View File

@ -71,9 +71,10 @@
<div id="content">
<h1>Module <code>Zone</code></h1>
<p>This module contains the ZONE classes, inherited from <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a>.</p>
<p>This core module contains the ZONE classes, inherited from <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a>.</p>
<p>There are essentially two core functions that zones accomodate:</p>
<ul>
@ -106,22 +107,23 @@
<hr/>
<h1>1) <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a> class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>This class is an abstract BASE class for derived classes, and is not meant to be instantiated.</p>
<h3>1.1) Each zone has a name:</h3>
<h2>1.1) Each zone has a name:</h2>
<ul>
<li><a href="##(ZONE_BASE).GetName">ZONE_BASE.GetName</a>(): Returns the name of the zone.</li>
</ul>
<h3>1.2) Each zone implements two polymorphic functions defined in <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a>:</h3>
<h2>1.2) Each zone implements two polymorphic functions defined in <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a>:</h2>
<ul>
<li><a href="##(ZONE_BASE).IsPointVec2InZone">ZONE_BASE.IsPointVec2InZone</a>(): Returns if a <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> is within the zone.</li>
<li><a href="##(ZONE_BASE).IsPointVec3InZone">ZONE_BASE.IsPointVec3InZone</a>(): Returns if a <a href="Point.html##(POINT_VEC3)">Point#POINT_VEC3</a> is within the zone.</li>
</ul>
<h3>1.3) A zone has a probability factor that can be set to randomize a selection between zones:</h3>
<h2>1.3) A zone has a probability factor that can be set to randomize a selection between zones:</h2>
<ul>
<li><a href="##(ZONE_BASE).SetRandomizeProbability">ZONE_BASE.SetRandomizeProbability</a>(): Set the randomization probability of a zone to be selected, taking a value between 0 and 1 ( 0 = 0%, 1 = 100% )</li>
@ -129,20 +131,20 @@
<li><a href="##(ZONE_BASE).GetZoneMaybe">ZONE_BASE.GetZoneMaybe</a>(): Get the zone taking into account the randomization probability. nil is returned if this zone is not a candidate.</li>
</ul>
<h3>1.4) A zone manages Vectors:</h3>
<h2>1.4) A zone manages Vectors:</h2>
<ul>
<li><a href="##(ZONE_BASE).GetVec2">ZONE_BASE.GetVec2</a>(): Returns the <a href="DCSTypes.html##(Vec2)">DCSTypes#Vec2</a> coordinate of the zone.</li>
<li><a href="##(ZONE_BASE).GetRandomVec2">ZONE_BASE.GetRandomVec2</a>(): Define a random <a href="DCSTypes.html##(Vec2)">DCSTypes#Vec2</a> within the zone.</li>
</ul>
<h3>1.5) A zone has a bounding square:</h3>
<h2>1.5) A zone has a bounding square:</h2>
<ul>
<li><a href="##(ZONE_BASE).GetBoundingSquare">ZONE_BASE.GetBoundingSquare</a>(): Get the outer most bounding square of the zone.</li>
</ul>
<h3>1.6) A zone can be marked:</h3>
<h2>1.6) A zone can be marked:</h2>
<ul>
<li><a href="##(ZONE_BASE).SmokeZone">ZONE_BASE.SmokeZone</a>(): Smokes the zone boundaries in a color.</li>
@ -152,58 +154,85 @@
<hr/>
<h1>2) <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a> class, extends <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a></h1>
<p>The ZONE<em>RADIUS class defined by a zone name, a location and a radius.
This class implements the inherited functions from Core.Zone#ZONE</em>BASE taking into account the own zone format and properties.</p>
<h3>2.1) <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a> constructor:</h3>
<h2>2.1) <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a> constructor</h2>
<ul>
<li><a href="##(ZONE_BASE).New">ZONE_BASE.New</a>(): Constructor.</li>
<li><a href="##(ZONE_RADIUS).New">ZONE_RADIUS.New</a>(): Constructor.</li>
</ul>
<h3>2.2) Manage the radius of the zone:</h3>
<h2>2.2) Manage the radius of the zone</h2>
<ul>
<li><a href="##(ZONE_BASE).SetRadius">ZONE_BASE.SetRadius</a>(): Sets the radius of the zone.</li>
<li><a href="##(ZONE_BASE).GetRadius">ZONE_BASE.GetRadius</a>(): Returns the radius of the zone.</li>
<li><a href="##(ZONE_RADIUS).SetRadius">ZONE_RADIUS.SetRadius</a>(): Sets the radius of the zone.</li>
<li><a href="##(ZONE_RADIUS).GetRadius">ZONE_RADIUS.GetRadius</a>(): Returns the radius of the zone.</li>
</ul>
<h3>2.3) Manage the location of the zone:</h3>
<h2>2.3) Manage the location of the zone</h2>
<ul>
<li><a href="##(ZONE_BASE).SetVec2">ZONE_BASE.SetVec2</a>(): Sets the <a href="DCSTypes.html##(Vec2)">DCSTypes#Vec2</a> of the zone.</li>
<li><a href="##(ZONE_BASE).GetVec2">ZONE_BASE.GetVec2</a>(): Returns the <a href="DCSTypes.html##(Vec2)">DCSTypes#Vec2</a> of the zone.</li>
<li><a href="##(ZONE_BASE).GetVec3">ZONE_BASE.GetVec3</a>(): Returns the <a href="DCSTypes.html##(Vec3)">DCSTypes#Vec3</a> of the zone, taking an additional height parameter.</li>
<li><a href="##(ZONE_RADIUS).SetVec2">ZONE_RADIUS.SetVec2</a>(): Sets the <a href="DCSTypes.html##(Vec2)">DCSTypes#Vec2</a> of the zone.</li>
<li><a href="##(ZONE_RADIUS).GetVec2">ZONE_RADIUS.GetVec2</a>(): Returns the <a href="DCSTypes.html##(Vec2)">DCSTypes#Vec2</a> of the zone.</li>
<li><a href="##(ZONE_RADIUS).GetVec3">ZONE_RADIUS.GetVec3</a>(): Returns the <a href="DCSTypes.html##(Vec3)">DCSTypes#Vec3</a> of the zone, taking an additional height parameter.</li>
</ul>
<h2>2.4) Zone point randomization</h2>
<p>Various functions exist to find random points within the zone.</p>
<ul>
<li><a href="##(ZONE_RADIUS).GetRandomVec2">ZONE_RADIUS.GetRandomVec2</a>(): Gets a random 2D point in the zone.</li>
<li><a href="##(ZONE_RADIUS).GetRandomPointVec2">ZONE_RADIUS.GetRandomPointVec2</a>(): Gets a <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> object representing a random 2D point in the zone.</li>
<li><a href="##(ZONE_RADIUS).GetRandomPointVec3">ZONE_RADIUS.GetRandomPointVec3</a>(): Gets a <a href="Point.html##(POINT_VEC3)">Point#POINT_VEC3</a> object representing a random 3D point in the zone. Note that the height of the point is at landheight.</li>
</ul>
<hr/>
<h1>3) <a href="Zone.html##(ZONE)">Zone#ZONE</a> class, extends <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a></h1>
<p>The ZONE class, defined by the zone name as defined within the Mission Editor.
This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.</p>
<hr/>
<h1>4) <a href="Zone.html##(ZONE_UNIT)">Zone#ZONE_UNIT</a> class, extends <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a></h1>
<p>The ZONE_UNIT class defined by a zone around a <a href="Unit.html##(UNIT)">Unit#UNIT</a> with a radius.
This class implements the inherited functions from <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a> taking into account the own zone format and properties.</p>
<hr/>
<h1>5) <a href="Zone.html##(ZONE_GROUP)">Zone#ZONE_GROUP</a> class, extends <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a></h1>
<p>The ZONE_GROUP class defines by a zone around a <a href="Group.html##(GROUP)">Group#GROUP</a> with a radius. The current leader of the group defines the center of the zone.
This class implements the inherited functions from <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a> taking into account the own zone format and properties.</p>
<hr/>
<h1>6) <a href="Zone.html##(ZONE_POLYGON_BASE)">Zone#ZONE<em>POLYGON</em>BASE</a> class, extends <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a></h1>
<p>The ZONE<em>POLYGON</em>BASE class defined by a sequence of <a href="Group.html##(GROUP)">Group#GROUP</a> waypoints within the Mission Editor, forming a polygon.
This class implements the inherited functions from <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a> taking into account the own zone format and properties.
This class is an abstract BASE class for derived classes, and is not meant to be instantiated.</p>
<h2>6.1) Zone point randomization</h2>
<p>Various functions exist to find random points within the zone.</p>
<ul>
<li><a href="##(ZONE_POLYGON_BASE).GetRandomVec2">ZONE<em>POLYGON</em>BASE.GetRandomVec2</a>(): Gets a random 2D point in the zone.</li>
<li><a href="##(ZONE_POLYGON_BASE).GetRandomPointVec2">ZONE<em>POLYGON</em>BASE.GetRandomPointVec2</a>(): Return a <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> object representing a random 2D point within the zone.</li>
<li><a href="##(ZONE_POLYGON_BASE).GetRandomPointVec3">ZONE<em>POLYGON</em>BASE.GetRandomPointVec3</a>(): Return a <a href="Point.html##(POINT_VEC3)">Point#POINT_VEC3</a> object representing a random 3D point at landheight within the zone.</li>
</ul>
<hr/>
<h1>7) <a href="Zone.html##(ZONE_POLYGON)">Zone#ZONE_POLYGON</a> class, extends <a href="Zone.html##(ZONE_POLYGON_BASE)">Zone#ZONE<em>POLYGON</em>BASE</a></h1>
<p>The ZONE_POLYGON class defined by a sequence of <a href="Group.html##(GROUP)">Group#GROUP</a> waypoints within the Mission Editor, forming a polygon.
This class implements the inherited functions from <a href="Zone.html##(ZONE_RADIUS)">Zone#ZONE_RADIUS</a> taking into account the own zone format and properties.</p>
@ -220,6 +249,14 @@ This class implements the inherited functions from <a href="Zone.html##(ZONE_RAD
<p>Hereby the change log:</p>
<p>2017-02-18: ZONE<em>POLYGON</em>BASE:<strong>GetRandomPointVec2()</strong> added.</p>
<p>2017-02-18: ZONE<em>POLYGON</em>BASE:<strong>GetRandomPointVec3()</strong> added.</p>
<p>2017-02-18: ZONE_RADIUS:<strong>GetRandomPointVec3( inner, outer )</strong> added.</p>
<p>2017-02-18: ZONE_RADIUS:<strong>GetRandomPointVec2( inner, outer )</strong> added.</p>
<p>2016-08-15: ZONE_BASE:<strong>GetName()</strong> added.</p>
<p>2016-08-15: ZONE_BASE:<strong>SetZoneProbability( ZoneProbability )</strong> added.</p>
@ -310,6 +347,12 @@ This class implements the inherited functions from <a href="Zone.html##(ZONE_RAD
<td class="name" nowrap="nowrap"><a href="##(ZONE_BASE).GetName">ZONE_BASE:GetName()</a></td>
<td class="summary">
<p>Returns the name of the zone.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(ZONE_BASE).GetRandomPointVec2">ZONE_BASE:GetRandomPointVec2()</a></td>
<td class="summary">
<p>Define a random <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> within the zone.</p>
</td>
</tr>
<tr>
@ -476,6 +519,18 @@ This class implements the inherited functions from <a href="Zone.html##(ZONE_RAD
<td class="name" nowrap="nowrap"><a href="##(ZONE_POLYGON_BASE).GetBoundingSquare">ZONE_POLYGON_BASE:GetBoundingSquare()</a></td>
<td class="summary">
<p>Get the bounding square the zone.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(ZONE_POLYGON_BASE).GetRandomPointVec2">ZONE_POLYGON_BASE:GetRandomPointVec2()</a></td>
<td class="summary">
<p>Return a <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> object representing a random 2D point at landheight within the zone.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(ZONE_POLYGON_BASE).GetRandomPointVec3">ZONE_POLYGON_BASE:GetRandomPointVec3()</a></td>
<td class="summary">
<p>Return a <a href="Point.html##(POINT_VEC3)">Point#POINT_VEC3</a> object representing a random 3D point at landheight within the zone.</p>
</td>
</tr>
<tr>
@ -528,12 +583,24 @@ This class implements the inherited functions from <a href="Zone.html##(ZONE_RAD
<td class="name" nowrap="nowrap"><a href="##(ZONE_RADIUS).GetRadius">ZONE_RADIUS:GetRadius()</a></td>
<td class="summary">
<p>Returns the radius of the zone.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(ZONE_RADIUS).GetRandomPointVec2">ZONE_RADIUS:GetRandomPointVec2(inner, outer)</a></td>
<td class="summary">
<p>Returns a <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> object reflecting a random 2D location within the zone.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(ZONE_RADIUS).GetRandomPointVec3">ZONE_RADIUS:GetRandomPointVec3(inner, outer)</a></td>
<td class="summary">
<p>Returns a <a href="Point.html##(POINT_VEC3)">Point#POINT_VEC3</a> object reflecting a random 3D location within the zone.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(ZONE_RADIUS).GetRandomVec2">ZONE_RADIUS:GetRandomVec2(inner, outer)</a></td>
<td class="summary">
<p>Returns a random location within the zone.</p>
<p>Returns a random Vec2 location within the zone.</p>
</td>
</tr>
<tr>
@ -853,6 +920,24 @@ The name of the zone.</p>
<dl class="function">
<dt>
<a id="#(ZONE_BASE).GetRandomPointVec2" >
<strong>ZONE_BASE:GetRandomPointVec2()</strong>
</a>
</dt>
<dd>
<p>Define a random <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> within the zone.</p>
<h3>Return value</h3>
<p><em><a href="Core.Point.html##(POINT_VEC2)">Core.Point#POINT_VEC2</a>:</em>
The PointVec2 coordinates.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(ZONE_BASE).GetRandomVec2" >
<strong>ZONE_BASE:GetRandomVec2()</strong>
</a>
@ -1371,6 +1456,42 @@ The bounding square.</p>
<dl class="function">
<dt>
<a id="#(ZONE_POLYGON_BASE).GetRandomPointVec2" >
<strong>ZONE_POLYGON_BASE:GetRandomPointVec2()</strong>
</a>
</dt>
<dd>
<p>Return a <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> object representing a random 2D point at landheight within the zone.</p>
<h3>Return value</h3>
<p><a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(ZONE_POLYGON_BASE).GetRandomPointVec3" >
<strong>ZONE_POLYGON_BASE:GetRandomPointVec3()</strong>
</a>
</dt>
<dd>
<p>Return a <a href="Point.html##(POINT_VEC3)">Point#POINT_VEC3</a> object representing a random 3D point at landheight within the zone.</p>
<h3>Return value</h3>
<p><a href="Point.html##(POINT_VEC3)">Point#POINT_VEC3</a></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(ZONE_POLYGON_BASE).GetRandomVec2" >
<strong>ZONE_POLYGON_BASE:GetRandomVec2()</strong>
</a>
@ -1580,26 +1701,92 @@ The radius of the zone.</p>
<dl class="function">
<dt>
<a id="#(ZONE_RADIUS).GetRandomVec2" >
<strong>ZONE_RADIUS:GetRandomVec2(inner, outer)</strong>
<a id="#(ZONE_RADIUS).GetRandomPointVec2" >
<strong>ZONE_RADIUS:GetRandomPointVec2(inner, outer)</strong>
</a>
</dt>
<dd>
<p>Returns a random location within the zone.</p>
<p>Returns a <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> object reflecting a random 2D location within the zone.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#number inner </em></code>:
minimal distance from the center of the zone</p>
(optional) Minimal distance from the center of the zone. Default is 0.</p>
</li>
<li>
<p><code><em>#number outer </em></code>:
minimal distance from the outer edge of the zone</p>
(optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="Core.Point.html##(POINT_VEC2)">Core.Point#POINT_VEC2</a>:</em>
The <a href="Point.html##(POINT_VEC2)">Point#POINT_VEC2</a> object reflecting the random 3D location within the zone.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(ZONE_RADIUS).GetRandomPointVec3" >
<strong>ZONE_RADIUS:GetRandomPointVec3(inner, outer)</strong>
</a>
</dt>
<dd>
<p>Returns a <a href="Point.html##(POINT_VEC3)">Point#POINT_VEC3</a> object reflecting a random 3D location within the zone.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#number inner </em></code>:
(optional) Minimal distance from the center of the zone. Default is 0.</p>
</li>
<li>
<p><code><em>#number outer </em></code>:
(optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="Core.Point.html##(POINT_VEC3)">Core.Point#POINT_VEC3</a>:</em>
The <a href="Point.html##(POINT_VEC3)">Point#POINT_VEC3</a> object reflecting the random 3D location within the zone.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(ZONE_RADIUS).GetRandomVec2" >
<strong>ZONE_RADIUS:GetRandomVec2(inner, outer)</strong>
</a>
</dt>
<dd>
<p>Returns a random Vec2 location within the zone.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#number inner </em></code>:
(optional) Minimal distance from the center of the zone. Default is 0.</p>
</li>
<li>
<p><code><em>#number outer </em></code>:
(optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.</p>
</li>
</ul>

View File

@ -416,7 +416,7 @@ which are excellent tools to be reused in an OO environment!.</p>
<tr>
<td class="name" nowrap="nowrap"><a href="Zone.html">Zone</a></td>
<td class="summary">
<p>This module contains the ZONE classes, inherited from <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a>.</p>
<p>This core module contains the ZONE classes, inherited from <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a>.</p>
</td>
</tr>
<tr>