Module Core.Vector
CORE - Vector algebra.
Main Features:
- Create vectors from components, DCS vectors, polar and spherical coordinates, or latitude and longitude
- Vector algebra with the
+,-,*,/, unary-and==operators - Interface to DCS API functions for land, atmosphere, effects and F10 map markings
- Hides the differences between the DCS 2D and 3D coordinate conventions
- Lightweight compared to COORDINATE
Example Missions:
Demo missions can be found on github.
Author: funkyfranky
Global(s)
Global VECTOR |
Mathematics knows no races or geographic boundaries; for mathematics, the cultural world is one country. --David Hilbert The VECTOR ConceptA VECTOR is a 3D vector in the DCS coordinate system. |
Mathematics knows no races or geographic boundaries; for mathematics, the cultural world is one country. --David Hilbert
The VECTOR Concept
A VECTOR is a 3D vector in the DCS coordinate system.
It can describe a position, for example of a unit, or a direction or velocity,
for example the wind. VECTOR instances are plain Lua tables with x, y and z fields and a metatable, which makes them cheap to create
and lets you combine them with the usual arithmetic operators.
The DCS Coordinate System
DCS uses different conventions for 2D and 3D vectors. You only need to care about this when you call DCS API functions directly or pass plain DCS tables to VECTOR methods. A VECTOR itself is always 3D.
3D (DCS#Vec3)
The x-axis points North. The z-axis points East. The y-axis points up and gives the altitude above mean sea level.
2D (DCS#Vec2)
The x-axis points North, as in 3D. The y-axis points East, so it corresponds to the z-axis in 3D. There is no altitude.
Most methods accept a DCS#Vec2, a DCS#Vec3, a COORDINATE or a VECTOR as argument and detect a 2D table by its missing z field.
When a DCS#Vec2 is converted to a VECTOR, its altitude is 0. Methods that need a 3D point for DCS, such as VECTOR.IsVisible or
VECTOR.GetProfile, use the land height for a DCS#Vec2. VECTOR.GetVec2 and VECTOR.GetVec3 convert back to plain DCS tables.
Constructors
All constructors start with New and return a new instance.
From Components
VECTOR.New takes the components directly. With three arguments, they are x (North), y (altitude) and z (East).
With two arguments, the second one is the East component and the altitude is 0.
local a=VECTOR:New(1000, 500, 2000) -- 1000 m North, 2000 m East, 500 m altitude.
local b=VECTOR:New(1000, 2000) -- Same horizontal position at altitude 0.
From 2D or 3D Vectors
VECTOR.NewFromVec copies the position of a DCS#Vec2, DCS#Vec3, COORDINATE or VECTOR. VECTOR.NewDirectionalVector returns the vector pointing from one given position to another.
local v=VECTOR:NewFromVec(trigger.misc.getZone("Target").point)
From Polar Coordinates
VECTOR.NewFromPolar creates a horizontal vector from a distance and a heading in degrees (0 = North, 90 = East).
local east=VECTOR:NewFromPolar(1000, 90) -- x=0, y=0, z=1000
From Spherical Coordinates
VECTOR.NewFromSpherical takes a distance, the angle from the upward y-axis and a heading, all angles in degrees.
local north=VECTOR:NewFromSpherical(1000, 90, 0) -- Horizontal, x=1000, y=0, z=0
local up=VECTOR:NewFromSpherical(1000, 0, 0) -- Straight up, y=1000
From Latitude and Longitude
VECTOR.NewFromLLDD takes decimal degrees, VECTOR.NewFromLLDMS takes DMS strings. Without an altitude, both use the land height.
local v1=VECTOR:NewFromLLDD(41.93, 41.86)
local v2=VECTOR:NewFromLLDMS([[41° 55' 48"N]], [[41° 51' 36"E]], 1000)
Operators
All operators return a new VECTOR and leave their operands unchanged. + and - only accept two VECTOR instances. To add or subtract
a plain DCS#Vec2, DCS#Vec3 or COORDINATE, use VECTOR.AddVec or VECTOR.SubVec, which change the vector in place.
Addition and Subtraction +, -
local c=a+b -- c.x=a.x+b.x, c.y=a.y+b.y, c.z=a.z+b.z
local d=a-b -- Directional vector from b to a.
Multiplication *
A vector times a number scales the vector. Two vectors are multiplied component by component. This is neither the dot product (VECTOR.Dot) nor the cross product (VECTOR.Rot).
local c=2*a -- or a*2
local d=a*b -- d.x=a.x*b.x, d.y=a.y*b.y, d.z=a.z*b.z
Division /
A vector divided by a number scales the vector. Two vectors are divided component by component.
local c=a/2
Negation and Comparison -, ==
Unary - reverses the direction. == is true if all components are exactly equal. For computed positions, compare the distance
from VECTOR.GetDistance with a tolerance instead.
Vector Algebra and Geometry
- Length and direction: VECTOR.GetLength, VECTOR.SetLength, VECTOR.Normalize, VECTOR.GetHeading
- Relations to another vector: VECTOR.GetDistance, VECTOR.GetDirectionalVectorTo, VECTOR.GetDirectionalVectorFrom, VECTOR.GetHeadingTo, VECTOR.GetHeadingFrom, VECTOR.GetHeadingDelta, VECTOR.GetIntermediateVector
- Products: VECTOR.Dot, VECTOR.Rot
- Changing the vector: VECTOR.SetX, VECTOR.SetY, VECTOR.SetZ, VECTOR.AddVec, VECTOR.SubVec, VECTOR.Replace, VECTOR.Translate, VECTOR.Rotate2D, VECTOR.Copy
Methods that change the vector return self, so calls can be chained:
local v=VECTOR:NewFromVec(zone.point):SetY():Translate(500, 45)
DCS API Interface
Land and Surface
VECTOR.GetSurfaceHeight, VECTOR.GetSurfaceHeightAndDepth, VECTOR.GetSurfaceType, VECTOR.GetSurfaceTypeName, VECTOR.IsVisible, VECTOR.GetProfile, VECTOR.GetInterceptPoint, VECTOR.GetClosestRoad, VECTOR.GetClosestRailroad, VECTOR.GetPathOnRoad
Atmosphere
VECTOR.GetWindVector, VECTOR.GetTemperatureAndPressure
Effects and Actions
VECTOR.Smoke, VECTOR.SmokeAndFire, VECTOR.StopSmoke, VECTOR.IlluminationBomb, VECTOR.Explosion, VECTOR.Flare
Map Markings
Coordinates
VECTOR.GetLatitudeLongitude, VECTOR.GetMGRS, VECTOR.ToStringMGRS, VECTOR.GetCoordinate
Interface to other MOOSE Classes
Several MOOSE classes provide their position or direction as VECTOR:
- Wrapper.Positionable#POSITIONABLE.GetVector: Position of a UNIT, STATIC or other positionable object.
- Wrapper.Positionable#POSITIONABLE.GetVelocityVector: Velocity in m/s.
- Wrapper.Positionable#POSITIONABLE.GetOrientationVectors: Orientation as three unit vectors.
- SCENERY objects store their position in the field
Vector.
For other objects, such as zones or groups, create the vector from their DCS#Vec2 or DCS#Vec3 with VECTOR.NewFromVec.
Global _VECTORID |
VECTOR unique ID |
VECTOR unique ID
Type(s)
| Fields and Methods inherited from VECTOR | Description |
|---|---|
|
Add a vector to this vector in place. |
|
VECTOR:ArrowTo(Vector, Coalition, Color, FillColor, LineType) |
Creates an arrow on the F10 map from this vector to the given vector. |
|
Name of the class. |
|
|
Get a copy of this vector. |
|
|
Calculate the dot product of this VECTOR with another vector. |
|
|
Creates an explosion at this vector with the specified power. |
|
|
Creates a signal flare at this vector in the specified color. |
|
|
Get the closest point on a railroad. |
|
|
Get the closest point on a road. |
|
|
Get a COORDINATE object. |
|
|
Get the directional vector that points from another VECTOR |
|
|
Get the directional vector that points from this VECTOR to another VECTOR |
|
|
Get the distance from this vector to another vector. |
|
|
Get heading of vector. |
|
|
Get the shortest signed heading change from this vector to another vector. |
|
|
Get the heading from a given vector to this vector. |
|
|
Get the heading from this vector to another given vector. |
|
|
Returns the point where a ray from this vector in the given direction intercepts the terrain within a specified distance. |
|
|
Interpolate from this vector to the destination. |
|
|
Get latitude and longitude of this vector. |
|
|
Get length/norm/magnitude of this vector. |
|
|
Get MGRS information of this vector. |
|
|
Get the path on roads from this vector to a given other vector. |
|
|
Get the terrain profile from this vector to the destination. |
|
|
Returns the land height at the 2D position of this vector. |
|
|
Returns the surface height and the water depth at the 2D position of this vector. |
|
|
Get the surface type at the vector. |
|
|
Get the name of the surface type at the vector. |
|
|
Returns the temperature and pressure at this vector. |
|
|
Returns the temperature and pressure at this vector. |
|
|
Get 2D vector as simple table. |
|
|
Get 3D vector as simple table. |
|
|
Returns the wind velocity vector at this vector. |
|
|
Creates an illumination bomb at this vector. |
|
|
Check if a given vector has line of sight with this vector. |
|
|
Create mark on F10 map. |
|
|
Create a new VECTOR class instance from given cartesian coordinates |
|
|
Get the directional vector that points from a given vector |
|
|
Create a new VECTOR from latitude and longitude in decimal degrees (DD). |
|
|
Create a new VECTOR from latitude and longitude in degrees, minutes, and seconds (DMS). |
|
|
Create a horizontal VECTOR from polar coordinates. |
|
|
Create a VECTOR from spherical coordinates in the DCS coordinate system. |
|
|
Create a new VECTOR class instance from given 2D or 3D vector object. |
|
|
Normalize this vector so that it has a length of 1. |
|
|
Replace the components of this vector with those of another one. |
|
|
Calculate the cross product of this VECTOR with another vector. |
|
|
Rotate the VECTOR clockwise (seen from above) in the horizontal (x,z) plane. |
|
|
Set length/norm/magnitude of this vector. |
|
|
Set x-component of vector. |
|
|
Set y-component of vector. |
|
|
Set z-component of vector. |
|
|
Creates a smoke at this vector. |
|
|
Creates a large smoke and fire effect of a specified type and density at this vector. |
|
|
Stop smoke or fire effect. |
|
|
Subtract a vector from this vector in place. |
|
|
Provides an MGRS string. |
|
|
Translate the vector horizontally by a given distance and heading. |
|
|
Check if passed object is a Vector. |
|
|
Meta function to add vectors together. |
|
|
Meta function for dividing a vector by a scalar or by another vector. |
|
|
Meta function to check if two vectors are equal. |
|
|
VECTOR private index. |
|
|
Meta function to multiply a vector by a scalar or, component by component, by another vector. |
|
|
Meta function to subtract vectors. |
|
|
Meta function to change how vectors appear as string. |
|
|
Meta function to make vectors negative. |
|
|
Unique ID of this vector instance. Used, for example, for the names of smoke effects. |
|
|
Verbosity of output. |
|
|
VECTOR class version. |
|
|
Component pointing North if > 0 and South if < 0. |
|
|
Component pointing up if > 0 and down if < 0. This describes the altitude above mean sea level. |
|
|
Component pointing East if > 0 and West if < 0. |
VECTOR class.
Field(s)
Name of the class.
Unique ID of this vector instance. Used, for example, for the names of smoke effects.
Verbosity of output.
VECTOR class version.
Component pointing North if > 0 and South if < 0.
Component pointing up if > 0 and down if < 0. This describes the altitude above mean sea level.
Component pointing East if > 0 and West if < 0.
Function(s)
Add a vector to this vector in place.
This function works for DCS#Vec2, DCS#Vec3, VECTOR and COORDINATE objects.
A DCS#Vec2 leaves the altitude unchanged. To get a new vector from two VECTORs, use the + operator.
Creates an arrow on the F10 map from this vector to the given vector.
DCS draws the arrowhead at the first point passed to trigger.action.arrowToAll, so the given vector is passed first, as in Core.Point#COORDINATE.ArrowToAll.
Defined in:
VECTOR
Parameters:
#VECTOR Vector
The vector the arrow points to.
#number Coalition
(Optional) Coalition Id: -1=All, 0=Neutral, 1=Red, 2=Blue. Default -1.
#table Color
(Optional) RGB color with alpha {r, g, b, alpha}. Default {1, 0, 0, 0.7}.
#table FillColor
(Optional) RGB color with alpha {r, g, b, alpha}. Default {1, 0, 0, 0.5}.
#number LineType
(Optional) Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot Dash, 5=Long Dash, 6=Two Dash. Default 1.
Return value:
#number:
Marker ID. Can be used to remove the drawing.
Get a copy of this vector.
The copy gets its own uid.
Calculate the dot product of this VECTOR with another vector.
This function works for DCS#Vec2, DCS#Vec3, VECTOR and COORDINATE objects. A DCS#Vec2 only uses the horizontal components.
Defined in:
VECTOR
Parameter:
DCS#Vec3 Vec
The other vector. Can also be a DCS#Vec2, DCS#Vec3, COORDINATE or VECTOR object.
Return value:
#number:
Dot product Sum_i(a[i]*b[i]). Note that this is a scalar and not a vector any more!
Creates an explosion at this vector with the specified power.
Defined in:
VECTOR
Parameter:
#number Power
(Optional) The power in kg TNT. Default 100 kg.
Return value:
self
Creates a signal flare at this vector in the specified color.
The flare will be launched in the direction of the azimuth angle.
Defined in:
VECTOR
Parameters:
#number Color
(Optional) Color of the flare, see FLARECOLOR: 0=Green, 1=Red, 2=White, 3=Yellow. Default 0.
#number Azimuth
(Optional) Azimuth angle in degrees. Default 0.
Return value:
self
Get the closest point on a railroad.
Defined in:
VECTOR
Return value:
Closest point on a railroad with altitude 0, or nil if DCS returns no point.
Get the closest point on a road.
Defined in:
VECTOR
Return value:
Closest point on a road with altitude 0, or nil if DCS returns no point.
Get a COORDINATE object.
Defined in:
VECTOR
Parameter:
#boolean OnSurface
(Optional) If true, the altitude is set to the land height [m] at the 2D position.
Return value:
The COORDINATE object.
Get the directional vector that points from another VECTOR a to this VECTOR.
Get the directional vector that points from this VECTOR to another VECTOR a.
Get the distance from this vector to another vector.
Defined in:
VECTOR
Parameters:
#VECTOR Vector
Vector to which the distance is requested. Also accepts a DCS#Vec2, DCS#Vec3 or COORDINATE. A DCS#Vec2 always gives the 2D distance.
#boolean Only2D
(Optional) If true, calculate only the projected 2D distance.
Return value:
#number:
Distance in meters.
Get heading of vector.
Note that a heading of
- 000° = North
- 090° = East
- 180° = South
- 270° = West.
Defined in:
VECTOR
Parameter:
#boolean To360
If true or nil, adjust heading to [0,360) range. If false, the heading is in (-180,180].
Return value:
#number:
Heading in degrees.
Get the shortest signed heading change from this vector to another vector.
Positive values turn clockwise. A half-turn returns -180 degrees.
Defined in:
VECTOR
Parameter:
#VECTOR Vector
The vector giving the target heading.
Return value:
#number:
Heading change in degrees in the range [-180, 180).
Get the heading from a given vector to this vector.
Defined in:
VECTOR
Parameter:
#VECTOR Vector
Vector from which the heading is requested. Also accepts a DCS#Vec2, DCS#Vec3 or COORDINATE.
Return value:
#number:
Heading from the other vector to this vector in degrees in [0,360).
Get the heading from this vector to another given vector.
Defined in:
VECTOR
Parameter:
#VECTOR Vector
Vector to which the heading is requested. Also accepts a DCS#Vec2, DCS#Vec3 or COORDINATE.
Return value:
#number:
Heading from this vector to the other vector in degrees in [0,360).
Returns the point where a ray from this vector in the given direction intercepts the terrain within a specified distance.
Defined in:
VECTOR
Parameters:
DCS#Vec3 DirectionVector
Directional vector of any length. It is normalized before it is passed to DCS and stays unchanged.
#number Distance
(Optional) Maximum ray length in meters. Default 1000 m.
Return value:
Intercept vector. Can be nil if no intercept point is found.
Interpolate from this vector to the destination.
With a Vec2 destination, the result uses this vector's altitude.
Get latitude and longitude of this vector.
Defined in:
VECTOR
Return values:
#number:
Latitude in decimal degrees (DD).
#number:
Longitude in decimal degrees (DD).
Get length/norm/magnitude of this vector.
Defined in:
VECTOR
Return value:
#number:
Length of vector.
Get MGRS information of this vector.
MGRS = {UTMZone = string, MGRSDigraph = string, Easting = number, Northing = number}
Defined in:
VECTOR
Return value:
#table:
MGRS table with UTMZone, MGRSDigraph, Easting and Northing keys.
Get the path on roads from this vector to a given other vector.
Defined in:
VECTOR
Parameter:
#VECTOR Vec
The destination vector. Also accepts a DCS#Vec2, DCS#Vec3 or any MOOSE object with a GetVec2 method, such as a COORDINATE, ZONE or UNIT.
Return value:
Pathline with points on road, or nil if no path is found or the destination has no position.
Get the terrain profile from this vector to the destination.
Defined in:
VECTOR
Parameter:
DCS#Vec3 Destination
The destination as a Vec3 or VECTOR. A DCS#Vec2 uses the terrain height.
Return value:
The profile as a pathline, or nil if no profile is available.
Returns the land height at the 2D position of this vector.
Defined in:
VECTOR
Return value:
#number:
Height above mean sea level in meters.
Returns the surface height and the water depth at the 2D position of this vector.
Defined in:
VECTOR
Return values:
#number:
Surface height above mean sea level in meters.
#number:
Water depth (positive) at this point in meters.
Get the surface type at the vector.
- LAND = 1
- SHALLOW_WATER = 2
- WATER = 3
- ROAD = 4
- RUNWAY = 5
Defined in:
VECTOR
Return value:
#number:
Surface type
Get the name of the surface type at the vector.
The name is the key in land.SurfaceType: LAND, SHALLOW_WATER, WATER, ROAD or RUNWAY.
Defined in:
VECTOR
Return value:
#string:
Surface type name, or "unknown" if DCS returns a type not listed in land.SurfaceType.
Returns the temperature and pressure at this vector.
Kept for compatibility. Use VECTOR.GetTemperatureAndPressure instead.
Defined in:
VECTOR
Return values:
#number:
Temperature in Kelvin.
#number:
Pressure in Pascals.
Returns the temperature and pressure at this vector.
Defined in:
VECTOR
Return values:
#number:
Temperature in Kelvin.
#number:
Pressure in Pascals.
Get 2D vector as simple table.
Get 3D vector as simple table.
Defined in:
VECTOR
Parameter:
#boolean OnSurface
(Optional) If true, the y component is set to the land height [m] at the 2D position.
Return value:
New table {x=x, y=y, z=z}.
Returns the wind velocity vector at this vector.
Turbulence can optionally be included.
Defined in:
VECTOR
Parameter:
#boolean WithTurbulence
(Optional) If true, return wind including turbulence.
Return value:
Velocity 3D vector [m/s] the wind is blowing to.
Creates an illumination bomb at this vector.
Defined in:
VECTOR
Parameters:
#number Power
(Optional) The power in Candela (cd). Should be between 1 and 1000000. Default 1000 cd.
#number Altitude
(Optional) Altitude [m] at which the illumination bomb is created. Default is the altitude of this vector.
Return value:
self
Check if a given vector has line of sight with this vector.
Defined in:
VECTOR
Parameter:
#VECTOR Vec
The other vector. Also accepts a DCS#Vec3 or COORDINATE. A DCS#Vec2 uses the terrain height.
Return value:
#boolean:
True if there is line of sight between the vectors.
Create mark on F10 map.
Defined in:
VECTOR
Parameters:
#string MarkText
Free format text of the mark.
#number Recipient
(Optional) Recipient of the mark: -1=All (default), 0=Neutral, 1=Red, 2=Blue. Can also be a GROUP object.
#boolean ReadOnly
(Optional) Mark is readonly and cannot be removed by users. Default false.
Return value:
#number:
Mark ID, or nil if the recipient is unknown.
Create a new VECTOR class instance from given cartesian coordinates x, y and z, where z is optional.
Note that whether the z component is passed or nil has great impact on the interpretation of the y component.
If z is not given (nil), then y is used as z (the coordinate pointing East) and the altitude is set to 0, because we always construct a 3D vector.
If z is given (not nil), then y is used as coordinate pointing up (out of plane) as for all 3D DCS vectors.
Defined in:
VECTOR
Parameters:
#number x
Component of vector along x-axis (pointing North in both 2D and 3D).
#number y
Component of vector along y-axis (pointing East in 2D and Up in 3D).
#number z
(Optional) Component of the z-axis (pointing East in 3D).
Return value:
A new vector.
Get the directional vector that points from a given vector a to another given vector b.
The vector is c=-a+b=b-a. If either vector is a DCS#Vec2, the result is horizontal (y=0),
as with VECTOR.GetDirectionalVectorTo.
Create a new VECTOR from latitude and longitude in decimal degrees (DD).
Defined in:
VECTOR
Parameters:
#number Latitude
Latitude in decimal degrees.
#number Longitude
Longitude in decimal degrees.
#number Altitude
(Optional) Altitude in meters. Default is the land height at the 2D position.
Return value:
A new vector at the requested position.
Create a new VECTOR from latitude and longitude in degrees, minutes, and seconds (DMS).
Use a leading sign or a trailing hemisphere letter for direction. See Utilities.Utils#UTILS.LLDMSstringToDD for the format.
Defined in:
VECTOR
Parameters:
#string Latitude
Latitude in DMS, for example 42° 24' 14.3"N.
#string Longitude
Longitude in DMS, for example 30° 15' 00"E.
#number Altitude
(Optional) Altitude in meters. Default is the land height at the coordinate.
Return value:
A new vector at the requested position.
Create a horizontal VECTOR from polar coordinates.
Defined in:
VECTOR
Parameters:
#number r
Distance from the origin in meters.
#number phi
Heading in degrees. North is 0 (+x), east is 90 (+z).
Return value:
A new vector with zero altitude.
Create a VECTOR from spherical coordinates in the DCS coordinate system.
Defined in:
VECTOR
Parameters:
#number r
Non-negative distance from the origin in meters.
#number theta
Angle from the upward y-axis in degrees, from 0 to 180.
#number phi
Heading in degrees in [0, 360). North is 0 (+x), east is 90 (+z).
Return value:
A new vector at the requested position.
Create a new VECTOR class instance from given 2D or 3D vector object.
Normalize this vector so that it has a length of 1.
A zero vector stays zero.
Replace the components of this vector with those of another one.
If the given vector is a DCS#Vec2, only the horizontal components are replaced unless Project2D is set.
Defined in:
VECTOR
Parameters:
#VECTOR Vector
The vector that is used to replace this vector. Also accepts a DCS#Vec2, DCS#Vec3 or COORDINATE.
#boolean Project2D
(Optional) If true and the given vector is 2D, the altitude is set to 0. Otherwise, y stays unchanged.
Return value:
self updated
Calculate the cross product of this VECTOR with another vector.
Rotate the VECTOR clockwise (seen from above) in the horizontal (x,z) plane.
The altitude y stays unchanged.
Defined in:
VECTOR
Parameters:
#number Angle
(Optional) Rotation angle in degrees. Default 0.
#boolean Copy
(Optional) If true, rotate a copy and leave this vector unchanged.
Return value:
This vector or the rotated copy.
Set length/norm/magnitude of this vector.
A zero vector stays zero.
Set x-component of vector.
The x-axis points to the North.
Defined in:
VECTOR
Parameter:
#number x
(Optional) Value of x. Default 0.
Return value:
self
Set y-component of vector.
The y-axis points upwards and describes the altitude above mean sea level.
Defined in:
VECTOR
Parameter:
#number y
(Optional) Value of y. Default land/surface height at this point.
Return value:
self
Set z-component of vector.
The z-axis points to the East.
Defined in:
VECTOR
Parameter:
#number z
(Optional) Value of z. Default 0.
Return value:
self
Creates a smoke at this vector.
Defined in:
VECTOR
Parameters:
#number Color
(Optional) Color of the smoke, see SMOKECOLOR: 0=Green, 1=Red, 2=White, 3=Orange, 4=Blue. Default 0.
#number Duration
(Optional) Duration of the smoke in seconds. Default: no automatic stop.
Return value:
#string:
Unique name of this smoke effect. Pass it to StopSmoke to stop the effect.
Creates a large smoke and fire effect of a specified type and density at this vector.
- 1 = small smoke and fire
- 2 = medium smoke and fire
- 3 = large smoke and fire
- 4 = huge smoke and fire
- 5 = small smoke
- 6 = medium smoke
- 7 = large smoke
- 8 = huge smoke
Defined in:
VECTOR
Parameters:
#number Preset
(Optional) Preset of smoke. Default BIGSMOKEPRESET.LargeSmokeAndFire.
#number Density
(Optional) Density between [0,1]. Default 0.5.
#number Duration
(Optional) Duration of the smoke and fire in seconds. Default: no automatic stop.
Return value:
#string:
Unique name of this smoke and fire effect. Pass it to StopSmoke to stop the effect.
Stop smoke or fire effect.
Defined in:
VECTOR
Parameters:
#string Name
Name of the effect as returned by VECTOR.Smoke or VECTOR.SmokeAndFire.
#number Delay
(Optional) Delay in seconds before the effect is stopped. Default: stop immediately.
Return value:
self
Subtract a vector from this vector in place.
This function works for DCS#Vec2, DCS#Vec3, VECTOR and COORDINATE objects.
A DCS#Vec2 leaves the altitude unchanged. To get a new vector from two VECTORs, use the - operator.
Provides an MGRS string.
Defined in:
VECTOR
Parameter:
Core.Settings#SETTINGS Settings
(Optional) Settings providing MGRS_Accuracy. Default is the global _SETTINGS.
Return value:
#string:
The MGRS text.
Translate the vector horizontally by a given distance and heading.
The altitude y stays unchanged.
Defined in:
VECTOR
Parameters:
#number Distance
(Optional) Distance in meters. Default 1000 meters.
#number Heading
(Optional) Heading angle in degrees. Default 0° = North.
#boolean Copy
(Optional) If true, translate a copy and leave this vector unchanged.
Return value:
This vector or the translated copy.
Check if passed object is a Vector.
Defined in:
VECTOR
Parameter:
#table t
The object to be tested.
Return value:
#boolean:
Returns true if t is a #VECTOR and false otherwise.
Meta function to add vectors together.
Meta function for dividing a vector by a scalar or by another vector.
Meta function to check if two vectors are equal.
Defined in:
VECTOR
Parameters:
#VECTOR a
Vector a.
#VECTOR b
Vector b.
Return value:
#boolean:
If true, all components are exactly equal. Use VECTOR.GetDistance with a tolerance for computed positions.
Meta function to multiply a vector by a scalar or, component by component, by another vector.
This is not the dot product, see VECTOR.Dot.
Meta function to subtract vectors.
Meta function to change how vectors appear as string.
Defined in:
VECTOR
Return value:
#string:
String representation of vector.
Meta function to make vectors negative.