mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
VECTOR
- Added functions
This commit is contained in:
parent
9c7b5e8506
commit
c46061466c
@ -243,14 +243,14 @@ end
|
||||
|
||||
--- Get points of pathline. Not that points are tables, that contain more information as just the 2D or 3D position but also the surface type etc.
|
||||
-- @param #PATHLINE self
|
||||
-- @return <Core.Pathline#PATHLINE.Point> List of points.
|
||||
-- @return #list <Core.Pathline#PATHLINE.Point> List of points.
|
||||
function PATHLINE:GetPoints()
|
||||
return self.points
|
||||
end
|
||||
|
||||
--- Get segments of pathline.
|
||||
-- @param #PATHLINE self
|
||||
-- @return <Core.Pathline#PATHLINE.Segment> List of points.
|
||||
-- @return #list <Core.Pathline#PATHLINE.Segment> List of points.
|
||||
function PATHLINE:GetSetments()
|
||||
|
||||
local segments={}
|
||||
@ -267,7 +267,7 @@ end
|
||||
|
||||
--- Get 3D points of pathline.
|
||||
-- @param #PATHLINE self
|
||||
-- @return <DCS#Vec3> List of DCS#Vec3 points.
|
||||
-- @return #list <DCS#Vec3> List of DCS#Vec3 points.
|
||||
function PATHLINE:GetPoints3D()
|
||||
|
||||
local vecs={}
|
||||
@ -282,7 +282,7 @@ end
|
||||
|
||||
--- Get 2D points of pathline.
|
||||
-- @param #PATHLINE self
|
||||
-- @return <DCS#Vec2> List of DCS#Vec2 points.
|
||||
-- @return #list <DCS#Vec2> List of DCS#Vec2 points.
|
||||
function PATHLINE:GetPoints2D()
|
||||
|
||||
local vecs={}
|
||||
@ -297,7 +297,7 @@ end
|
||||
|
||||
--- Get COORDINATES of pathline. Note that COORDINATE objects are created when calling this function. That does involve deep copy calls and can have an impact on performance if done too often.
|
||||
-- @param #PATHLINE self
|
||||
-- @return <Core.Point#COORDINATE> List of COORDINATES points.
|
||||
-- @return #list <Core.Point#COORDINATE> List of COORDINATES points.
|
||||
function PATHLINE:GetCoordinats()
|
||||
|
||||
local vecs={}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -296,6 +296,20 @@ function ZONE_BASE:GetCoordinate( Height ) --R2.1
|
||||
return self.Coordinate
|
||||
end
|
||||
|
||||
--- Returns the @{Core.Vector#VECTOR} of the zone.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @param DCS#Distance Height The height in meters to add to the land height where the center of the zone is located.
|
||||
-- @return Core.Vector#VECTOR The vector of the zone.
|
||||
function ZONE_BASE:GetVector( Height )
|
||||
self:F2(self.ZoneName)
|
||||
|
||||
local Vec3 = self:GetVec3( Height )
|
||||
|
||||
local vector=VECTOR:NewFromVec(Vec3)
|
||||
|
||||
return vector
|
||||
end
|
||||
|
||||
--- Get 2D distance to a coordinate.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @param Core.Point#COORDINATE Coordinate Reference coordinate. Can also be a DCS#Vec2 or DCS#Vec3 object.
|
||||
|
||||
@ -484,7 +484,7 @@ NAVPOINT.version="0.0.1"
|
||||
-- @return #NAVPOINT self
|
||||
function NAVPOINT:NewFromCoordinate(Name, Coordinate)
|
||||
|
||||
-- Inherit everything from SCENERY class.
|
||||
-- Inherit everything from BASE class.
|
||||
self=BASE:Inherit(self, BASE:New()) -- #NAVFIX
|
||||
|
||||
self.coordinate=Coordinate
|
||||
|
||||
@ -3038,6 +3038,20 @@ function UTILS.BearingToCardinal(Heading)
|
||||
end
|
||||
end
|
||||
|
||||
--- Adjust given heading so that is is in [0, 360).
|
||||
-- @param #number Heading The heading in degrees.
|
||||
-- @return #number Adjust heading in [0,360).
|
||||
function UTILS.AdjustHeading360(Heading)
|
||||
|
||||
if Heading>=360 then
|
||||
Heading=Heading-360
|
||||
elseif Heading<0 then
|
||||
Heading=Heading+360
|
||||
end
|
||||
|
||||
return Heading
|
||||
end
|
||||
|
||||
--- Create a BRAA NATO call string BRAA between two GROUP objects
|
||||
-- @param Wrapper.Group#GROUP FromGrp GROUP object
|
||||
-- @param Wrapper.Group#GROUP ToGrp GROUP object
|
||||
|
||||
@ -1074,6 +1074,24 @@ function GROUP:GetAverageVec3()
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns the current VECTOR of the GROUP.
|
||||
-- @param #GROUP self
|
||||
-- @return Core.Vector#VECTOR Current VECTOR of the first Unit of the GROUP. Can return `nil` if no unit can be found.
|
||||
function GROUP:GetVector()
|
||||
|
||||
-- Get first unit.
|
||||
local unit=self:GetUnit(1)
|
||||
|
||||
if unit then
|
||||
local vec3=unit:GetVec3()
|
||||
local vector=VECTOR:New(vec3.x, vec3.y, vec3.z)
|
||||
return vector
|
||||
end
|
||||
|
||||
self:E("ERROR: Cannot get VECTOR of group "..tostring(self.GroupName))
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns a POINT_VEC2 object indicating the point in 2D of the first UNIT of the GROUP within the mission.
|
||||
-- @param #GROUP self
|
||||
-- @return Core.Point#POINT_VEC2 The 2D point vector of the first DCS Unit of the GROUP.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user