Reworked zone and vector functions

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:
FlightControl
2017-02-18 22:38:31 +01:00
parent b9b2caed65
commit d7c2e0f900
28 changed files with 1019 additions and 142 deletions

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