mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
CT v0.0.2
This commit is contained in:
@@ -657,24 +657,24 @@ function UTILS.Randomize(value, fac, lower, upper)
|
||||
return r
|
||||
end
|
||||
|
||||
--- Calculate the dot (scalar) product of two vectors.
|
||||
-- @param DCS#Vec3 a Vector in 3D with x,y,z components.
|
||||
-- @param DCS#Vec3 b Vector in 3D with x,y,z components.
|
||||
--- Calculate the [dot product](https://en.wikipedia.org/wiki/Dot_product) of two vectors. The result is a number.
|
||||
-- @param DCS#Vec3 a Vector in 3D with x, y, z components.
|
||||
-- @param DCS#Vec3 b Vector in 3D with x, y, z components.
|
||||
-- @return #number Scalar product of the two vectors a*b.
|
||||
function UTILS.VecDot(a, b)
|
||||
return a.x*b.x + a.y*b.y + a.z*b.z
|
||||
end
|
||||
|
||||
--- Calculate the eucledian norm (length) of a 3D vector.
|
||||
-- @param DCS#Vec3 a Vector in 3D with x,y,z components.
|
||||
--- Calculate the [euclidean norm](https://en.wikipedia.org/wiki/Euclidean_distance) (length) of a 3D vector.
|
||||
-- @param DCS#Vec3 a Vector in 3D with x, y, z components.
|
||||
-- @return #number Norm of the vector.
|
||||
function UTILS.VecNorm(a)
|
||||
return math.sqrt(UTILS.DotProduct(a, a))
|
||||
return math.sqrt(UTILS.VecDot(a, a))
|
||||
end
|
||||
|
||||
--- Calculate the cross product of two 3D vectors.
|
||||
-- @param DCS#Vec3 a Vector in 3D with x,y,z components.
|
||||
-- @param DCS#Vec3 b Vector in 3D with x,y,z components.
|
||||
--- Calculate the [cross product](https://en.wikipedia.org/wiki/Cross_product) of two 3D vectors. The result is a 3D vector.
|
||||
-- @param DCS#Vec3 a Vector in 3D with x, y, z components.
|
||||
-- @param DCS#Vec3 b Vector in 3D with x, y, z components.
|
||||
-- @return DCS#Vec3 Vector
|
||||
function UTILS.VecCross(a, b)
|
||||
return {x=a.y*b.z - a.z*b.y, y=a.z*b.x - a.x*b.z, z=a.x*b.y - a.y*b.x}
|
||||
|
||||
Reference in New Issue
Block a user