Module HOUND.Utils
HOUND.Utils This class holds generic function used by all of Hound Components
Tables
HOUND.Utils | HOUND.Utils decleration |
General functions
Value mapping Functions
HOUND.Utils.Mapping.clamp (input, out_min, out_max) | clamn values to range (minmax) |
HOUND.Utils.Mapping.linear (input, in_min, in_max, out_min, out_max[, clamp]) | map input to range (Arduino implementation) |
HOUND.Utils.Mapping.nonLinear (value, in_min, in_max[, out_min[, out_max[, sensitivity[, curve_type]]]]) | Map values on a curve |
DCS object functions
Geo Function
HOUND.Utils.Geo.checkLOS (pos0, pos1) | Return if the is LOS between two DCS points checks both radar horizon (round earth) and DCS terrain LOS |
HOUND.Utils.Geo.EarthLOS (h0[, h1]) | Returns maximum horizon distance given heigh above the earth of two points if only one observer hight is provided, result would be maximum view distance to Sea Level |
HOUND.Utils.Geo.getProjectedIP (p0, az, el) | Returns Projected line impact point with Terrain |
HOUND.Utils.Geo.setPointHeight (point, offset) | Ensure Inpoint DCS point has Elevation |
HOUND.Utils.Geo.setHeight (point, offset) | Ensure input point or point table all have valid Elevation |
HOUND.Utils.Geo.get2DDistance (src, dst) | Get 2D distance between two points wrapper for mist.utils.get2DDist |
HOUND.Utils.Geo.get3DDistance (src, dst) | Get 3D distance between two points wrapper for mist.utils.get3DDist |
Marker Functions
HOUND.Utils.Marker.getId () | Get next Markpoint Id |
HOUND.Utils.Marker.setInitialId (startId) | Set New initial marker Id |
HOUND.Utils.Marker.create ([args]) | create Marker entity |
HOUND.Utils.Marker.instance
instance.setPos (self, pos) | update markpoint position |
instance.setText (self, text) | update markpoint text |
instance.setRadius (self, radius) | update markpoint radius |
instance.setFillColor (self, color) | update markpoint fill color |
instance.setLineColor (self, color) | update markpoint line color |
instance.setLineType (self, lineType) | update markpoint line type |
instance.isDrawn (self) | Check if marpoint is drawn |
instance.remove (self) | remove markpoint |
instance._new (self, args) | create new point (internal) |
instance._replace (self, args) | replace markpoint (internal) |
instance.update (self, args) | update markpoint |
Text Functions
HOUND.Utils.Text.getLL (lat, lon[, minDec]) | convert LL to displayable string |
HOUND.Utils.Text.getTime ([timestamp]) | Text Function - returns current DCS time in military time format string |
Elint functions
HOUND.Utils.Elint.generateAngularError (variance) | Elint Function - Generate angular error |
HOUND.Utils.Elint.getAzimuth (src, dst, sensorPrecision) | Get Azimuth (and elevation) between two points |
HOUND.Utils.Elint.getSignalStrength (src, dst, maxDetection) | Get Signal strength of point |
HOUND.Utils.Elint.getActiveRadars (instanceCoalition) | Get currently transmitting Ground and Ship radars that are not in the Hound Instance coalition |
HOUND.Utils.Elint.getActiveRadarsInGroup (GroupName) | Get currently transmitting units in a given groupName |
HOUND.Utils.Elint.getRwrContacts (platform) | Get RWR contacts for platfom |
Vector functions
HOUND.Utils.Vector.getUnitVector (Theta[, Phi]) | get UnitVector |
HOUND.Utils.Vector.getRandomVec2 (variance) | Get random 2D vector use Box–Muller transform to randomize errors on 2D vector https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform} |
HOUND.Utils.Vector.getRandomVec3 (variance) | Get random 3d vector use Box–Muller transform to randomize errors on 3D vector https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform} |
Zone functions
HOUND.Utils.Zone.listDrawnZones () | List all Useable zones from drawings. |
HOUND.Utils.Zone.getDrawnZone (zoneName) | Get zone from drawing (supported types are freeForm Polygon, rectangle and Oval) |
HOUND.Utils.Zone.getGroupRoute (GroupName) | get polygon defined by group waypoints |
Sort Functions
HOUND.Utils.Sort.ContactsByRange (a, b) | Sort contacts by engament range |
HOUND.Utils.Sort.ContactsById (a, b) | Sort contacts by ID |
HOUND.Utils.Sort.ContactsByPrio (a, b) | sort contacts by Priority (primary first) |
HOUND.Utils.Sort.sectorsByPriorityLowFirst (a, b) | sort sectors by priority (low first) |
HOUND.Utils.Sort.sectorsByPriorityLowLast (a, b) | sort sectors by priority (Low last) |
Filter Functions
HOUND.Utils.Filter.groupsByPrefix (prefix) | get Groups by prefix |
HOUND.Utils.Filter.unitsByPrefix (prefix) | get Units by prefix |
HOUND.Utils.Filter.staticObjectsByPrefix (prefix) | get StatcObjects by prefix |
TTS Functions
Polygon functions
HOUND.Utils.Polygon.threatOnSector (polygon, point, radius) | Check if polygon is under threat of SAM |
HOUND.Utils.Polygon.filterPointsByPolygon (points, polygon) | Filter out points not in polygon |
HOUND.Utils.Polygon.clipPolygons (subjectPolygon, clipPolygon) | calculate cliping of polygons Sutherland-Hodgman polygon clipping |
HOUND.Utils.Polygon.giftWrap (points) | Gift wrapping algorithem Returns the convex hull (using Jarvis' Gift wrapping algorithm). |
HOUND.Utils.Polygon.circumcirclePoints (points) | calculate Smallest circle around point cloud Welzel algorithm for Smallest-circle problem Implementation taken from github/rowins |
HOUND.Utils.Polygon.getArea (polygon) | return the area of a convex polygon |
HOUND.Utils.Polygon.clipOrHull (polyA, polyB) | clip or hull two polygons |
HOUND.Utils.Polygon.azMinMax (poly, refPos) | find min/max azimuth |
Clustering algorithems (for future use)
HOUND.Utils.Cluster.gaussianKernel (value, bandwidth) | Get gaussian weight |
HOUND.Utils.Cluster.stdDev () | Calculate running std dev |
HOUND.Utils.Cluster.weightedMean (origPoints[, initPos[, threashold[, maxIttr]]]) | find the weighted mean of a points cluster (meanShift) |
HOUND.Utils.Cluster.getDeltaSubsetPercent (Table, referencePos, NthPercentile, returnRelative) | Get a list of Nth elements centerd around a position from table of positions. |
HOUND.Utils.Cluster.WeightedCentroid (PosList) | Calculate weighted least squares estimate from a list of positions with scores |
HOUND.Utils.Cluster.WLS_GDOP (measurements, initial_guess[, max_iter=10[, tol=0.001]]) | Weighted Least Squares with GDOP-based uncertainty ellipse Calculates position estimate using weighted least squares with geometric dilution of precision |
Tables
- HOUND.Utils
-
HOUND.Utils decleration
Fields:
- Mapping Extrapulation functions
- Geo Geographic functions
- Text Text functions
- Elint Elint functions
- Sort Sort funtions
- Filter Filter functions
- ReportId intrnal ATIS numerator
- _MarkId internal markId Counter
- _HoundId internal HoundId counter
General functions
- HOUND.Utils.getHoundId ()
-
get next Hound Instance Id
Returns:
-
#number Next HoundId
- HOUND.Utils.getMarkId ()
-
Get next Markpoint Id (Depricated)
Returns:
-
Next MarkId
See also:
- HOUND.Utils.setInitialMarkId (startId)
-
Set New initial marker Id (DEPRICATED)
Parameters:
- startId Number to start counting from
Returns:
-
Bool
True if initial ID was updated
See also:
- HOUND.Utils.absTimeDelta (t0[, t1])
-
Get time delta between two timestemps
Parameters:
- t0 time to test (in number of seconds)
- t1 time in number of seconds. if not provided, will use current DCS mission time (optional)
Returns:
-
time delta between t0 and t1
Usage:
HOUND.Utils.absTimeDelta(<10s ago>,now) ==> 10
- HOUND.Utils.angleDeltaRad (rad1, rad2)
-
return difference in radias between two angles (bearings)
Parameters:
- rad1 angle in radians
- rad2 angle in radians
Returns:
-
angle difference between rad1 and rad2 (between pi and -pi)
- HOUND.Utils.normalizeAngle (rad)
-
normlize angle in radians
Parameters:
- rad number
Returns:
-
normlized angle in rad (0-2Pi)
- HOUND.Utils.AzimuthAverage (azimuths)
-
return avarage azimuth
Parameters:
- azimuths a list of azimuths in radians
Returns:
-
the avarage azimuth of the list provided in radians (between 0 and 2*pi)
- HOUND.Utils.getMagVar (DCSpoint)
-
Return magnetic variation in point
Parameters:
- DCSpoint point
Returns:
-
Magentic variation in radians
- HOUND.Utils.PointClusterTilt (points[, MagNorth[, refPos]])
-
return the tilt of a point cluster
Parameters:
- points a list of DCS points
- MagNorth (Bool) if true value will include north var correction (optional)
- refPos a DCS point that will be the reference for azimuth (optional)
Returns:
-
azimuth in radians (between 0 and pi)
- HOUND.Utils.RandomAngle ()
-
returns a random angle
Returns:
-
random angle in radians between 0 and 2*pi
- HOUND.Utils.getRoundedElevationFt (elev[, resolution])
-
return ground elevation rouded to 50 feet
Parameters:
- elev Height in meters
- resolution round to the nerest increment. default is 50 (optional)
Returns:
-
elevation converted to feet, rounded to the nearest 50 ft
- HOUND.Utils.roundToNearest (input, nearest)
-
return rounted number nearest a set interval
Parameters:
- input numeric value to be rounded
- nearest numeric value of the step to round input to (e.g 10,50,500)
Returns:
-
input number rounded to the nearest interval provided.(e.g 3244 -> 3250)
- HOUND.Utils.getNormalAngularError (variance)
-
get normal distribution angular error.
will generate gaussian magnitude based on variance and random angle
Parameters:
- variance error margin requester (in radians)
Returns:
-
table {el,az}, contining error in Azimuth and elevation in radians
- HOUND.Utils.getControllerResponse ()
-
get random controller snarky remark
Returns:
-
random response string from pool
- HOUND.Utils.getCoalitionString (coalitionID)
-
get coalition string
Parameters:
- coalitionID integer of DCS coalition id
Returns:
-
string name of coalition
- HOUND.Utils.getHemispheres (lat, lon, fullText)
-
returns hemisphere information for LatLon
Parameters:
- lat (float) latitude in decimal Degrees
- lon (float) longitude in decimal Degrees
- fullText (bool) determin if function should return "E" or "East"
Returns:
-
(table) {NS=string,EW=string} return hemisphere strings
- HOUND.Utils.getReportId ([ReportId])
-
get "ATIS" report ID
returns next Phonetic report ID.
Report ID loops around, i.e "Alpha" --> "Bravo" -> .. -> "Zulu" -> "Alpha"
Parameters:
- ReportId char, current report ID if not using global var (optional)
Returns:
- (string) phonetic ID ("Alpha","Bravo", "charlie"...)
- (Char) letter of ReportId ('A','B','C','D')
- HOUND.Utils.DecToDMS (cood)
-
Convert Decimal Degrees to DMS (D.DD to DMS)
Parameters:
- cood (float) lat or lon (e.g. 35.443, -124.5543)
Returns:
-
DMS (table)
{ d=deg,
m=minutes,
s=sec,
mDec = Decimal minutes
}
- HOUND.Utils.getBR (src, dst)
-
retrun Bearing (magnetic) and range between two points
Parameters:
- src (DCS pos) Position of source
- dst (DCS pos) Position of destination
Returns:
-
(table) {br = bearing(float), brStr=bearing(string, 3 chars rounded, e.g "044"), rng = Range in NM}
- HOUND.Utils.getFormationCallsign (player[, override[, flightMember]])
-
Get group callsign from unit
Parameters:
- player mist.DB entry to get formation callsign for
- override callsign substitution table (optional)
- flightMember if True. value returned will be the full callsign (i.e "Uzi 1 1" rather then the default "Uzi 1") (optional)
Returns:
-
Formation callsign string
- HOUND.Utils.getHoundCallsign ([namePool])
-
get Callsign
Parameters:
- namePool string "GENERIC" or "NATO" (optional)
Returns:
-
string random callsign from pool
- HOUND.Utils.useDMM (DcsUnit)
-
Unit use DMM
Parameters:
- DcsUnit DCS Unit or typeName string
- HOUND.Utils.useMGRS (DcsUnit)
-
Unit use MGRS
Parameters:
- DcsUnit DCS Unit or typeName string
- HOUND.Utils.hasPayload (DcsUnit, payloadName)
-
does unit has payload (placeholder)
Parameters:
- DcsUnit DCS unit
- payloadName Name of payload
Returns:
-
bool
always true
- HOUND.Utils.hasTask (DcsUnit, taskName)
-
does unit has task (placeholder)
Parameters:
- DcsUnit DCS unit
- taskName Name of task
Returns:
-
bool
always true
Value mapping Functions
- HOUND.Utils.Mapping.clamp (input, out_min, out_max)
-
clamn values to range (minmax)
Parameters:
- input number value
- out_min number Minimum output value
- out_max number Maximum output value
- HOUND.Utils.Mapping.linear (input, in_min, in_max, out_min, out_max[, clamp])
-
map input to range (Arduino implementation)
Parameters:
- input value
- in_min Minimum allowble input value
- in_max Maximum allowable input value
- out_min Minimum allowable output value
- out_max Maximum allowable output value
- clamp Bool if true values will be clipped at range specified (optional)
Returns:
-
calculated mapped value
Usage:
HOUND.Utils.Mapping.linear(10,0,10,0,100) = 100 HOUND.Utils.Mapping.linear(0.5,0,1,0,100) = 50
- HOUND.Utils.Mapping.nonLinear (value, in_min, in_max[, out_min[, out_max[, sensitivity[, curve_type]]]])
-
Map values on a curve
Parameters:
- value original input
- in_min Minimum input value
- in_max Maximum input value
- out_min Minimum output value (0 if not specified) (optional)
- out_max Maximum output value (1 if not specified) (optional)
- sensitivity requested sensitivity (0-9, default 9 is leased curved) (optional)
- curve_type requested curve profile (0-6, 0 is default) (optional)
DCS object functions
- HOUND.Utils.Dcs.isPoint (point)
-
check if point is DCS point
Parameters:
- point DCS point candidate
Returns:
-
Bool
True if is valid point
- HOUND.Utils.Dcs.isUnit (obj)
-
check if object is DCS Unit
Parameters:
- obj DCS Object canidate
Returns:
-
Bool
True if object is unit
- HOUND.Utils.Dcs.isGroup (obj)
-
check if object is DCS Group
Parameters:
- obj DCS Object canidate
Returns:
-
Bool
True if object is Group
- HOUND.Utils.Dcs.isStaticObject (obj)
-
check if object is DCS static object
Parameters:
- obj DCS Object canidate
Returns:
-
Bool
True if object is static object
- HOUND.Utils.Dcs.isHuman (obj)
-
check if object is a human unit
Parameters:
- obj DCS Object canidate
Returns:
-
Bool
True if object is a Human unit
- HOUND.Utils.Dcs.getPlayers (coalitionId)
-
get list of human clinets for hound.
Parameters:
- coalitionId
Returns:
-
list of units
- HOUND.Utils.Dcs.getPlayersInGroup (DcsGroup)
-
get human players in group
Parameters:
- DcsGroup tab
Returns:
-
table of players in group
- HOUND.Utils.Dcs.isRadarTracking (DcsUnit)
-
check if Unit is tracking anything with it's radar
Parameters:
- DcsUnit
Returns:
-
bool
True if tracking
- HOUND.Utils.Dcs.getSamMaxRange (DcsUnit)
-
return maximum weapon range in the group of DCS Unit
Parameters:
- DcsUnit DCS unit - in Hound context unit with emitting radar
Returns:
-
maximum weapon range in meters of the DCS Group the emitter is part of
- HOUND.Utils.Dcs.getRadarDetectionRange (DcsUnit)
-
return Radar detection Range for provided unit
Parameters:
- DcsUnit DCS Unit with radars sensor
Returns:
-
Unit radar detection range agains airborne targers in meters
- HOUND.Utils.Dcs.getRadarUnitsInGroup (DcsGroup)
-
return all radar units in group
Parameters:
- DcsGroup DCS Group
Returns:
-
table
Table of radar units in group
- HOUND.Utils.Dcs.getGroupNames (prefix)
-
get all current Groups, name only
Parameters:
- prefix optional string return only groups starting with prefix
Returns:
-
table of currently existing DCS group names
- HOUND.Utils.Dcs.getUnitNames (prefix)
-
get all current Groups, name only
Parameters:
- prefix optional string return only groups starting with prefix
Returns:
-
table of currently existing DCS group names
- HOUND.Utils.Dcs.getStaticObjectNames (prefix)
-
get all current static objects, name only
Parameters:
- prefix
Returns:
-
table of currently existing DCS static object names
Geo Function
- HOUND.Utils.Geo.checkLOS (pos0, pos1)
-
Return if the is LOS between two DCS points
checks both radar horizon (round earth) and DCS terrain LOS
Parameters:
- pos0 (DCS pos)
- pos1 (DCS pos)
Returns:
-
(bool) true if both units have LOS between them
- HOUND.Utils.Geo.EarthLOS (h0[, h1])
-
Returns maximum horizon distance given heigh above the earth of two points
if only one observer hight is provided, result would be maximum view distance to Sea Level
Parameters:
- h0 height of observer 1 in meters
- h1 height of observer 2 in meters (optional)
Returns:
-
distance maximum LOS distance in meters
- HOUND.Utils.Geo.getProjectedIP (p0, az, el)
-
Returns Projected line impact point with Terrain
Parameters:
- p0 source Postion
- az Azimuth from Position (radians)
- el Elevation angle from position (radians)
Returns:
-
DCS point of intersection with ground
- HOUND.Utils.Geo.setPointHeight (point, offset)
-
Ensure Inpoint DCS point has Elevation
Parameters:
- point DCS point
- offset optional number offset in meters from actual height
Returns:
-
Point but with elevation
- HOUND.Utils.Geo.setHeight (point, offset)
-
Ensure input point or point table all have valid Elevation
Parameters:
- point DCS point
- offset optional number offset in meters from actual height
Returns:
-
same as input, but with elevation. will return original value if is not DCS point
- HOUND.Utils.Geo.get2DDistance (src, dst)
-
Get 2D distance between two points
wrapper for mist.utils.get2DDist
Parameters:
- src dcs point
- dst dcs point
Returns:
-
distance in meters
- HOUND.Utils.Geo.get3DDistance (src, dst)
-
Get 3D distance between two points
wrapper for mist.utils.get3DDist
Parameters:
- src dcs point
- dst dcs point
Returns:
-
distance in meters
Marker Functions
- HOUND.Utils.Marker.getId ()
-
Get next Markpoint Id
Returns:
-
Next MarkId
- HOUND.Utils.Marker.setInitialId (startId)
-
Set New initial marker Id
Parameters:
- startId Number to start counting from
Returns:
-
Bool
True if initial ID was updated
- HOUND.Utils.Marker.create ([args])
-
create Marker entity
Parameters:
- args parameters of markpoint (optional)
Returns:
-
Hound Marker Instance
HOUND.Utils.Marker.instance
- instance.setPos (self, pos)
-
update markpoint position
Parameters:
- self Hound Marker instance
- pos position of marker (only single point is supported)
- instance.setText (self, text)
-
update markpoint text
Parameters:
- self Hound Marker instance
- text new text for marker
- instance.setRadius (self, radius)
-
update markpoint radius
Parameters:
- self Hound Marker instance
- radius new radius of markpoint (only circle type marks are supported)
- instance.setFillColor (self, color)
-
update markpoint fill color
Parameters:
- self Hound Marker instance
- color new fill color of marker
- instance.setLineColor (self, color)
-
update markpoint line color
Parameters:
- self Hound Marker instance
- color new fill color of marker
- instance.setLineType (self, lineType)
-
update markpoint line type
Parameters:
- self Hound Marker instance
- lineType new lineType for marker
- instance.isDrawn (self)
-
Check if marpoint is drawn
Parameters:
- self Hound Marker instance
Returns:
-
bool
- True if marker is drawn
- instance.remove (self)
-
remove markpoint
Parameters:
- self Hound Marker instance
- instance._new (self, args)
-
create new point (internal)
Parameters:
- self Hound Marker instance
- args full args array
- instance._replace (self, args)
-
replace markpoint (internal)
Parameters:
- self Hound Marker instance
- args full args array
- instance.update (self, args)
-
update markpoint
Parameters:
- self Hound Marker instance
- args full args array
Text Functions
- HOUND.Utils.Text.getLL (lat, lon[, minDec])
-
convert LL to displayable string
Parameters:
- lat Latitude in decimal degrees ("32.343","-14.44333")
- lon Longitude in decimal degrees ("42.343","-144.432")
- minDec (bool) if true, function will return LL in DM.M format (optional)
Returns:
-
LL string.
eg. "N33°15'12" E042°10'45"" or "N33°15.200' E042°10.750'"
- HOUND.Utils.Text.getTime ([timestamp])
-
Text Function - returns current DCS time in military time format string
Parameters:
- timestamp DCS time in seconds (timer.getAbsTime()) - Optional, if not arg provided will return for current game time (optional)
Returns:
-
time in human radable format e.g. "1430", "0812"
Elint functions
- HOUND.Utils.Elint.generateAngularError (variance)
-
Elint Function - Generate angular error
Parameters:
- variance amount of variance in gausian random function
Returns:
-
table {az,el} error in radians per element
- HOUND.Utils.Elint.getAzimuth (src, dst, sensorPrecision)
-
Get Azimuth (and elevation) between two points
Parameters:
- src position of the source (i.e Hound platform)
- dst position of the destination (i.e emitting radar)
- sensorPrecision angular resolution (in rad) of platform against radar
Returns:
- number Azimuth from source to destination in radians (0 to 2*pi)
- number Elevation angle from source to destination in radians (-pi to pi)
- table the vector betweeb the points
- HOUND.Utils.Elint.getSignalStrength (src, dst, maxDetection)
-
Get Signal strength of point
Parameters:
- src position of the source (i.e Hound platform)
- dst position of the destination (i.e emitting radar)
- maxDetection Maximum detection range of radar in meters
Returns:
-
number
Signal strength
- HOUND.Utils.Elint.getActiveRadars (instanceCoalition)
-
Get currently transmitting Ground and Ship radars that are not in the Hound Instance coalition
Parameters:
- instanceCoalition CoalitionID for current Hound Instance
Returns:
-
Table of all currently transmitting Ground and Ship radars that are not in the Hound Instance coalition
- HOUND.Utils.Elint.getActiveRadarsInGroup (GroupName)
-
Get currently transmitting units in a given groupName
Parameters:
- GroupName groupName for group
Returns:
-
Table of all currently transmitting Ground and Ship radars that are not in the Hound Instance coalition
- HOUND.Utils.Elint.getRwrContacts (platform)
-
Get RWR contacts for platfom
Parameters:
- platform DCS Unit of platform
Returns:
-
Table of all currently transmitting Ground and Ship radars that RWR detected by supplied platform
Vector functions
- HOUND.Utils.Vector.getUnitVector (Theta[, Phi])
-
get UnitVector
Parameters:
- Theta azimuth in radians
- Phi elevation in radians (optional)
Returns:
-
Unit vector {x,y,z}
- HOUND.Utils.Vector.getRandomVec2 (variance)
-
Get random 2D vector
use Box–Muller transform to randomize errors on 2D vector
https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform}
Parameters:
- variance amount of variance in gausian random function
Returns:
-
DCS standard {x,z,y} vector
- HOUND.Utils.Vector.getRandomVec3 (variance)
-
Get random 3d vector
use Box–Muller transform to randomize errors on 3D vector
https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform}
Parameters:
- variance amount of variance in gausian random function
Returns:
-
DCS standard {x,z,y} vector
Zone functions
- HOUND.Utils.Zone.listDrawnZones ()
-
List all Useable zones from drawings.
(supported types are freeForm Polygon, rectangle and Oval)
Returns:
-
list of strings
- HOUND.Utils.Zone.getDrawnZone (zoneName)
-
Get zone from drawing
(supported types are freeForm Polygon, rectangle and Oval)
Parameters:
- zoneName
Returns:
-
table of points
- HOUND.Utils.Zone.getGroupRoute (GroupName)
-
get polygon defined by group waypoints
Parameters:
- GroupName
Returns:
-
table of points if group exists or nil
Sort Functions
- HOUND.Utils.Sort.ContactsByRange (a, b)
-
Sort contacts by engament range
Parameters:
- a HOUND.Contact.Emitter instance
- b HOUND.Contact.Emitter Instance
Returns:
-
bool
Usage:
table.sort(unSorted,HOUND.Utils.Sort.ContactsByRange)
- HOUND.Utils.Sort.ContactsById (a, b)
-
Sort contacts by ID
Parameters:
- a HOUND.Contact.Emitter instance
- b HOUND.Contact.Emitter Instance
Returns:
-
bool
Usage:
table.sort(unSorted,HOUND.Utils.Sort.ContactsById)
- HOUND.Utils.Sort.ContactsByPrio (a, b)
-
sort contacts by Priority (primary first)
Parameters:
- a HOUND.Contact.Emitter instance
- b HOUND.Contact.Emitter Instance
Returns:
-
bool
Usage:
table.sort(unSorted,HOUND.Utils.Sort.ContactsByPrio)
- HOUND.Utils.Sort.sectorsByPriorityLowFirst (a, b)
-
sort sectors by priority (low first)
Parameters:
- a HOUND.Sector instance
- b HOUND.Sector Instance
Returns:
-
bool
Usage:
table.sort(unSorted,HOUND.Utils.Sort.sectorsByPriorityLowFirst)
- HOUND.Utils.Sort.sectorsByPriorityLowLast (a, b)
-
sort sectors by priority (Low last)
Parameters:
- a HOUND.Sector instance
- b HOUND.Sector Instance
Returns:
-
bool
Usage:
table.sort(unSorted,HOUND.Utils.Sort.sectorsByPriorityLowLast)
Filter Functions
- HOUND.Utils.Filter.groupsByPrefix (prefix)
-
get Groups by prefix
Parameters:
- prefix string
Returns:
-
table of DCS groups indexed by group name
- HOUND.Utils.Filter.unitsByPrefix (prefix)
-
get Units by prefix
Parameters:
- prefix string
Returns:
-
table of DCS Units indexed by Unit name
- HOUND.Utils.Filter.staticObjectsByPrefix (prefix)
-
get StatcObjects by prefix
Parameters:
- prefix string
Returns:
-
table of DCS StaticObjects indexed by object name
TTS Functions
- HOUND.Utils.TTS.isAvailable ()
-
Check if TTS agent is available (private)
Returns:
-
Bool
True if TTS is available
- HOUND.Utils.TTS.getdefaultModulation (freq)
-
Return default Modulation based on frequency
Parameters:
- freq The frequency in Mhz, Hz or table of frequencies
Returns:
-
Modulation string "AM" or "FM"
- HOUND.Utils.TTS.Transmit (msg, coalitionID, args[, transmitterPos])
-
Transmit message using STTS (private)
Parameters:
- msg The message to transmit
- coalitionID Coalition to recive transmission
- args STTS settings in hash table (minimum required is {freq=})
- transmitterPos DCS Position point for transmitter (optional)
Returns:
-
STTS.TextToSpeech return value recived from STTS, currently estimated speechTime
- HOUND.Utils.TTS.TransmitSTTS (msg, coalitionID, args[, transmitterPos])
-
Transmit message using STTS
Parameters:
- msg The message to transmit
- coalitionID Coalition to recive transmission
- args STTS settings in hash table (minimum required is {freq=})
- transmitterPos DCS Position point for transmitter (optional)
Returns:
-
currently estimated speechTime
- HOUND.Utils.TTS.TransmitGRPC (msg, coalitionID, args[, transmitterPos])
-
Transmit message using gRPC.tts
Parameters:
- msg The message to transmit
- coalitionID Coalition to recive transmission
- args STTS settings in hash table (minimum required is {freq=})
- transmitterPos DCS Position point for transmitter (optional)
Returns:
-
currently estimated speechTime
- HOUND.Utils.TTS.getTtsTime ([timestamp])
-
returns current DCS time in military time string for TTS
Parameters:
- timestamp DCS time in seconds (timer.getAbsTime()) - if not arg provided will return for current game time (optional)
Returns:
-
timeString e.g. "14 30 local", "08 hundred local"
- HOUND.Utils.TTS.getVerbalConfidenceLevel (confidenceRadius)
-
return verbal accuracy description
in 500 meters interval
Parameters:
- confidenceRadius meters
Returns:
-
(string) Description of accuracy e.g "Very High","High","Low"...
- HOUND.Utils.TTS.getVerbalContactAge (timestamp[, isSimple[, NATO]])
-
Get Verbal description of contact age
has multiple "modes of operation"
Parameters:
- timestamp dcs time in seconds of last time a target was seen
- isSimple (bool) switch between output modes. true: "Active", "recent"... False: "3 seconds","5 minutes" (optional)
- NATO (bool) requires isSimple=true, will return only "Active" or "Awake" as per NATO Lowdown (optional)
Returns:
-
string of time passed based on selected flags.
- HOUND.Utils.TTS.getVerbalLL (lat, lon[, minDec])
-
convert LL to TTS string
Parameters:
- lat Latitude in decimal degrees ("32.343","-14.44333")
- lon Longitude in decimal degrees ("42.343","-144.432")
- minDec (bool) if true, function will return LL in DM.M format (optional)
Returns:
-
LL string.
eg. "North, 33 degrees, 15 minutes, 12 seconds, East, 42 degrees, 10 minutes, 45 seconds "
- HOUND.Utils.TTS.toPhonetic (str)
-
Convert string to phonetic text
Parameters:
- str String to convert
Returns:
-
string broken up to phonetics
Usage:
HOUND.Utils.TTS.toPhonetic("B29") will return "Bravo Two Niner"
- HOUND.Utils.TTS.getReadTime (length[, speed[, googleTTS]])
-
get estimated message read time
returns estimated time in seconds STTS will need to read a message
Parameters:
- length length of string to estimate (also except the string itself)
- speed speed setting for reading them message (optional)
- googleTTS Bool, if true calculation will be done for GoogleTTS engine (optional)
Returns:
-
estimated message read time in seconds
- HOUND.Utils.TTS.simplfyDistance (distanceM)
-
simplify distance
Parameters:
- distanceM Distance in meters to simplify
Returns:
-
Simplified distance
below 1km function will return number in meters
eg. 140m => 150m, 520m => 500m, 4539m => 4.5km
Polygon functions
- HOUND.Utils.Polygon.threatOnSector (polygon, point, radius)
-
Check if polygon is under threat of SAM
Parameters:
- polygon Table of point reprasenting a polygon
- point DCS position (x,z)
- radius Radius in Meters around point to test
Returns:
- Bool True if point is in polygon
- Bool True if radius around point intersects polygon
- HOUND.Utils.Polygon.filterPointsByPolygon (points, polygon)
-
Filter out points not in polygon
Parameters:
- points Points to filter
- polygon - enclosing polygon to filter by
Returns:
-
points from original set which are inside polygon.
- HOUND.Utils.Polygon.clipPolygons (subjectPolygon, clipPolygon)
-
calculate cliping of polygons
Sutherland-Hodgman polygon clipping
Parameters:
- subjectPolygon List of points of first polygon
- clipPolygon list of points of second polygon
Returns:
-
List of points of the clipped polygon or nil if not clipping found
- HOUND.Utils.Polygon.giftWrap (points)
-
Gift wrapping algorithem
Returns the convex hull (using Jarvis' Gift wrapping algorithm).
Parameters:
- points array of DCS points ({x=<value>,z=<value>})
Returns:
-
the convex hull as an array of points
- HOUND.Utils.Polygon.circumcirclePoints (points)
-
calculate Smallest circle around point cloud
Welzel algorithm for Smallest-circle problem
Implementation taken from github/rowins
Parameters:
- points Table containing cloud points
Returns:
-
Circle {x=<Center X>,z=<Center Z>, y=<Land height at XZ>,r=<radius in meters>}
- HOUND.Utils.Polygon.getArea (polygon)
-
return the area of a convex polygon
Parameters:
- polygon list of DCS points
Returns:
-
area of polygon
- HOUND.Utils.Polygon.clipOrHull (polyA, polyB)
-
clip or hull two polygons
Parameters:
- polyA polygon
- polyB polygon
Returns:
-
Polygon which is clip or convexHull of the two input polygons
- HOUND.Utils.Polygon.azMinMax (poly, refPos)
-
find min/max azimuth
Parameters:
- poly Polygon
- refPos DCS point to calculate from
Returns:
- deltaMinMax delta angle between the two extream points
- minAz (rad)
- maxAz (rad)
Clustering algorithems (for future use)
- HOUND.Utils.Cluster.gaussianKernel (value, bandwidth)
-
Get gaussian weight
Parameters:
- value input to evaluate
- bandwidth Standard diviation for weight calculation
- HOUND.Utils.Cluster.stdDev ()
-
Calculate running std dev
Returns:
-
std calc instance
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm
- HOUND.Utils.Cluster.weightedMean (origPoints[, initPos[, threashold[, maxIttr]]])
-
find the weighted mean of a points cluster (meanShift)
Parameters:
- origPoints DCS points cluster
- initPos externally provided initial mean (DCS Point) (optional)
- threashold distance in meters below with solution is considered converged (default 1m) (optional)
- maxIttr Max itterations from converging solution (default 100) (optional)
Returns:
-
DCS point of the cluster weighted mean
- HOUND.Utils.Cluster.getDeltaSubsetPercent (Table, referencePos, NthPercentile, returnRelative)
-
Get a list of Nth elements centerd around a position from table of positions.
Parameters:
- Table A List of positions
- referencePos Point in relations to all points are evaluated
- NthPercentile Percintile of which Datapoints are taken (0.6=60%)
- returnRelative If true returning array will contain relative positions to referencePos
Returns:
-
List
- HOUND.Utils.Cluster.WeightedCentroid (PosList)
-
Calculate weighted least squares estimate from a list of positions with scores
Parameters:
- PosList List of positions with scores
Returns:
-
Weighted average position estimate {x,y,z}
- HOUND.Utils.Cluster.WLS_GDOP (measurements, initial_guess[, max_iter=10[, tol=0.001]])
-
Weighted Least Squares with GDOP-based uncertainty ellipse
Calculates position estimate using weighted least squares with geometric dilution of precision
Parameters:
- measurements Table of measurements containing azimuth angles and platform positions
- initial_guess Initial position estimate {x,z}
- max_iter Maximum number of iterations for convergence (default 10)
- tol Convergence tolerance in meters (default 0.001)
Returns:
-
solution Position estimate {x,y,z}, uncertenty_data Uncertainty ellipse parameters