NAVYGROUP

- Improved heading into wind
This commit is contained in:
Frank
2023-09-27 10:53:19 +02:00
parent 7453a6c55d
commit 5d40091947
3 changed files with 50 additions and 13 deletions

View File

@@ -644,6 +644,41 @@ function VECTOR:SubVec(Vec)
return self
end
--- Calculate the dot product of this VECTOR with another vector. This function works for DCS#Vec2, DCS#Vec3, VECTOR, COORDINATE objects.
-- @param #VECTOR self
-- @param DCS#Vec3 Vec The other vector. Can also be a DCS#Vec2, DCS#Vec3, COORDINATE or VECTOR object.
-- @return #number Dot product Sum_i(a[i]*b[i]). Note that this is a **scalar** and not a vector any more!
function VECTOR:Dot(Vec)
local dot=self.x*Vec.x
if Vec.z then
dot=dot+self.y*Vec.y+self.z*Vec.z
else
-- Vec is 2D ==> we take its y-component for z.
dot=dot+self.z*Vec.y
end
return dot
end
--- Calculate the rotation or cross product of this VECTOR with another vector. This function works for DCS#Vec2, DCS#Vec3, VECTOR, COORDINATE objects.
-- @param #VECTOR self
-- @param DCS#Vec3 Vec The other vector. Can also be a DCS#Vec2, DCS#Vec3, COORDINATE or VECTOR object.
-- @return #VECTOR The cross product vector.
function VECTOR:Rot(Vec)
-- TODO:
local dot=self.x*Vec.x
if Vec.z then
dot=dot+self.y*Vec.y+self.z*Vec.z
else
-- Vec is 2D ==> we take its y-component for z.
dot=dot+self.z*Vec.y
end
return dot
end
--- Get a clone (deep copy) of this vector.
-- @param #VECTOR self
@@ -1012,8 +1047,6 @@ function VECTOR:ArrowToAll(Vector)
local vec3Start=self:GetVec3()
trigger.action.arrowToAll(coalition , id, vec3Start, vec3End, color, fillColor , lineType, readOnly, "")
return self