mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Vector
This commit is contained in:
@@ -141,7 +141,9 @@ VECTOR.__index = VECTOR
|
||||
-- ToDo list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: A lot...
|
||||
-- TODO: 3D rotation
|
||||
-- TODO: Markers
|
||||
-- TODO: Documentation
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Constructor
|
||||
@@ -1063,6 +1065,8 @@ end
|
||||
function VECTOR.__div(a, b)
|
||||
|
||||
assert(VECTOR._IsVector(a) and type(b) == "number", "div: wrong argument types (expected <vector> and <number>)")
|
||||
|
||||
env.info("FF __div")
|
||||
|
||||
local c=VECTOR:New(a.x/b, a.y/b, a.z/b)
|
||||
|
||||
@@ -1081,7 +1085,10 @@ end
|
||||
-- @param #VECTOR b Vector b.
|
||||
-- @return #boolean If `true`, both vectors are equal
|
||||
function VECTOR.__eq(a, b)
|
||||
assert(VECTOR._IsVector(a) and VECTOR._IsVector(b), "ERROR in VECTOR.__eq: wrong argument types: (expected <vector> and <vector>)")
|
||||
--assert(VECTOR._IsVector(a) and VECTOR._IsVector(b), "ERROR in VECTOR.__eq: wrong argument types: (expected <vector> and <vector>)")
|
||||
env.info("FF __eq",showMessageBox)
|
||||
BASE:I(a)
|
||||
BASE:I(b)
|
||||
return a.x==b.x and a.y==b.y and a.z==b.z
|
||||
end
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ function NAVAID:New(ZoneName, SceneryName, Type)
|
||||
|
||||
self.zone=ZONE:FindByName(ZoneName)
|
||||
|
||||
self.coordinate=self.zone:GetCoordinate()
|
||||
self=self.zone:GetCoordinate()
|
||||
|
||||
if SceneryName then
|
||||
self.scenery=SCENERY:FindByNameInZone(SceneryName, ZoneName)
|
||||
@@ -173,6 +173,8 @@ end
|
||||
-- Private Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- Add private CLASS functions here.
|
||||
-- No private NAVAID functions yet.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -434,7 +436,7 @@ end
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number verbose Verbosity of output.
|
||||
-- @field #string name Name of the point.
|
||||
-- @field Core.Point#COORDINATE coordinate Coordinate of the fix.
|
||||
-- @field Core.Vector#VECTOR vector Position vector of the fix.
|
||||
-- @field Wrapper.Marker#MARKER marker Marker on F10 map.
|
||||
-- @field #boolean isCompulsory Is this a compulsory fix.
|
||||
--
|
||||
@@ -477,17 +479,17 @@ NAVPOINT.version="0.0.1"
|
||||
-- Constructor(s)
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Create a new NAVPOINT class instance from a given COORDINATE.
|
||||
--- Create a new NAVPOINT class instance from a given VECTOR.
|
||||
-- @param #NAVPOINT self
|
||||
-- @param #string Name Name of the fix. Should be unique!
|
||||
-- @param Core.Point#COORDINATE Coordinate Coordinate of the point.
|
||||
-- @param Core.Vector#VECTOR Vector Position vector of the navpoint.
|
||||
-- @return #NAVPOINT self
|
||||
function NAVPOINT:NewFromCoordinate(Name, Coordinate)
|
||||
function NAVPOINT:NewFromVector(Name, Vector)
|
||||
|
||||
-- Inherit everything from BASE class.
|
||||
self=BASE:Inherit(self, BASE:New()) -- #NAVFIX
|
||||
|
||||
self.coordinate=Coordinate
|
||||
self.vector=Vector
|
||||
|
||||
self.name=Name
|
||||
|
||||
@@ -497,6 +499,18 @@ function NAVPOINT:NewFromCoordinate(Name, Coordinate)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Create a new NAVPOINT class instance from a given COORDINATE.
|
||||
-- @param #NAVPOINT self
|
||||
-- @param #string Name Name of the fix. Should be unique!
|
||||
-- @param Core.Point#COORDINATE Coordinate Coordinate of the point.
|
||||
-- @return #NAVPOINT self
|
||||
function NAVPOINT:NewFromCoordinate(Name, Coordinate)
|
||||
local Vector=VECTOR:NewFromVec(Coordinate)
|
||||
self=NAVPOINT:NewFromVector(Name, Vector)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Create a new NAVPOINT class instance from a given NAVPOINT.
|
||||
-- You have to specify the distance and bearing from the new point to the given point. *E.g.*, for a distance of 5 NM and a bearing of 090° (West), the
|
||||
-- new nav point is created 5 NM East of the given nav point. The reason is that this corresponts to convention used in most maps.
|
||||
|
||||
Reference in New Issue
Block a user