Geometry and Coordinates
Geometry is one of the easiest places for add-ons to become subtly wrong.
A script may look correct on one recording, then produce slightly different numbers in another simulator, theater, or coordinate system. Some simulators use flat local worlds. Others use geodetic coordinates on the Earth. Some data sources provide native simulator coordinates, while others only provide latitude, longitude, altitude, or Cartesian positions.
The purpose of Tacview's geometry and coordinate helpers is to keep add-on code simple, readable, and accurate.
Instead of asking every add-on author to reimplement the same coordinate math, these helpers centralize the logic inside Tacview. They can take into account the source simulator, the coordinate systems available in each transform, and the conventions used by Tacview itself.
This has two important benefits.
First, add-ons become easier to write and easier to review. A script can ask a clear question such as "what is the distance between these two transforms?" or "what is the azimuth from this object to that object?" without carrying pages of fragile math code.
Second, add-ons improve automatically when Tacview improves. If Tacview adds better handling for a simulator, fixes a coordinate edge case, or improves a geometric calculation, scripts using these helpers benefit from that work without every add-on having to be patched separately.
Use helpers before writing custom math
When a helper exists, prefer using it over duplicating the calculation in your add-on.
For example:
use GetDistanceBetweenTransforms() to measure range between two transforms;
use GetAzimuthBetweenTransforms() to calculate the direction from one transform to another;
use GetRelativeBearingBetweenTransforms() to calculate where one object is relative to another object's forward direction.
These functions work with transforms returned by GetObjectTransform() and let Tacview choose the most appropriate data available.
In some recordings, that may mean using native simulator coordinates to better match simulator numbers. In others, it may mean using geodetic coordinates to match real-world measurements.
The add-on does not need to know all of those details. It can focus on the analysis.
Coordinates, units, and conventions
Tacview uses consistent internal units and conventions.
Distances are expressed in meters. Angles are expressed in radians. Coordinates may come from different systems depending on the data source, but helpers are designed to hide unnecessary complexity whenever possible.
Different angle helpers may use different ranges depending on what the value represents. For example, azimuth is a full-circle direction from true north, while relative bearing is signed so left and right remain clear.
When displaying values to the user, use the normal display formatting functions. When exporting values to files, use the export formatting functions.
This keeps calculations clean internally while still producing readable panels, logs, charts, and exported data.
Available functions
More helpers may be added over time for common geometry and coordinate tasks such as bearing, relative bearing, aspect angle, elevation, coordinate conversion, and other spatial relationships.
See also
Last updated
