include/OnTubeVis/OnTubeVis.h file

The main include file containing the core API and including other, more specialized modules.

Classes

struct OTV_TerminateResult
The return value type for otv__terminate().
struct OTV_HermiteNode
A timestamped Hermite spline node.
struct OTV_SegmentArclen
Struct representing a Hermite segment's arc length parameterization.
struct OTV_Extrapolation
Structure encapsulating a single extrapolated segment.

Typedefs

using otv__startup_funct = bool(*)(const int, const char*const*)
The function pointer type for otv__startup().
using otv__wait_for_startup_funct = bool(*)(void)
The function pointer type for the otv__wait_for_startup() function.
using otv__terminate_funct = OTV_TerminateResult(*)(void)
The function pointer type for the otv__terminate() function.
using otv__get_module_filepath_funct = const char*(*)(void)
The function pointer type for otv__get_module_filepath().
using otv__start_vis_session_funct = bool(*)(OTV_VisSetupHandle)
The function pointer type for the otv__start_vis_session() function.
using otv__instantiate_Glyph_funct = OTV_Vec2(*)(const uint32_t, const uint32_t, const OTV_GlyphData*)
The function pointer type for the otv__instantiate_Glyph() function.
using otv__stream_spline_node_funct = void(*)(const uint32_t, const OTV_HermiteNode*, const OTV_SegmentArclen*)
The function pointer type for the otv__stream_spline_node() function.
using otv__stream_spline_node_and_extrapol_funct = void(*)(const uint32_t, const OTV_HermiteNode*, const OTV_SegmentArclen*, const OTV_Extrapolation*)
The function pointer type for the otv__stream_spline_node_and_extrapol() function.
using otv__compute_arclen_funct = OTV_SegmentArclen(*)(const OTV_HermiteNode*node0, const OTV_HermiteNode*node1, const float sigma)
The function pointer type for the otv__compute_arclen() function.
using otv__eval_arclen_funct = float(*)(const OTV_SegmentArclen*, const float)
The function pointer type for the otv__compute_arclen() function.
using otv__latlon_height_to_cartesian_funct = void(*)(const double, const double, const double)
The function pointer type for the otv__latlon_height_to_cartesian() function.
using otv__compute_extrapol_funct = void(*)(OTV_Extrapolation*, const uint32_t, const OTV_HermiteNode*, const OTV_HermiteNode*, const OTV_SegmentArclen*)
The function pointer type for the otv__compute_extrapol() function.
using otv__stream_glyph_funct = void(*)(const uint32_t, const uint32_t, const OTV_GlyphData*)
The function pointer type for the otv__stream_glyph() function.
using otv__stream_glyphs_funct = void(*)(const uint32_t, const uint32_t, const OTV_GlyphData*, const uint32_t)
The function pointer type for the otv__stream_glyphs() function.

Functions

auto otv__startup(const int argc, const char*const* argv) -> OTV_API bool
Initializes and starts the OnTubeVis main event loop. Since startup can take a while, this call will not block. Use otv__wait_for_startup() to wait until the implementation is ready to receive commands and check if the initialization was actually successful.
auto otv__wait_for_startup(void) -> OTV_API bool
Waits until the startup process initiated by otv__startup() is complete and the OnTubeVis implementation can receive commands.
auto otv__terminate(void) -> OTV_API OTV_TerminateResult
Requests the OnTubeVis main event loop to terminate and shut down.
auto otv__get_module_filepath(void) -> OTV_API const char*
Reports the file path of the currently loaded OnTubeVis library file.
auto otv__start_vis_session(OTV_VisSetupHandle vis_setup) -> OTV_API bool
Start the visualization with the given setup.
auto otv__instantiate_Glyph(const uint32_t traj_id, const uint32_t layer, const OTV_GlyphData* data) -> OTV_API OTV_Vec2
Instantiates the given glyph to calculate its geometry and returns its extents along the trajectory.
auto otv__stream_spline_node(const uint32_t traj_id, const OTV_HermiteNode* node, const OTV_SegmentArclen* arclen) -> OTV_API void
Stream a spline node (made up of position, tangent and a timestamp) to the indicated trajectory, when the active visualization is set up to not use smooth extrapolation.
auto otv__stream_spline_node_and_extrapol(const uint32_t traj_id, const OTV_HermiteNode* node, const OTV_SegmentArclen* arclen, const OTV_Extrapolation* extrapol) -> OTV_API void
Stream a spline node (made up of position, tangent and a timestamp) to the indicated trajectory, as well as the extrapolated path following the node that should be used for smooth position refreshes and displaying as-of-yet orphaned glyphs.
auto otv__compute_arclen(const OTV_HermiteNode* node0, const OTV_HermiteNode* node1, const float sigma) -> OTV_API OTV_SegmentArclen
Compute an arc length parameterization for the given Hermite curve.
auto otv__eval_arclen(const OTV_SegmentArclen* s, const float t) -> OTV_API float
Evaluate s(t), where s is defined by the coefficients of the provided arc length parameterization, to compute the arc length s at the given (time-like) curve parameter t.
auto otv__latlon_height_to_cartesian(const double latitude, const double longitude, const double height) -> OTV_API OTV_Vec3
Obtain the Cartesian coordinates for the given set of latitude/longitude and height values. This is only available if a geo reference has been configured during setup.
auto otv__compute_extrapol(OTV_Extrapolation* out, const uint32_t num, const OTV_HermiteNode* ref_node0, const OTV_HermiteNode* ref_node1, const OTV_SegmentArclen* ref_arclen) -> OTV_API void
Create a primitive extrapolation with the desired number of segments given one reference Hermite segment to extrapolate from.
auto otv__stream_glyph(const uint32_t traj_id, const uint32_t layer, const OTV_GlyphData* glyph_data) -> OTV_API void
Stream a single glyph instance to the specified layer on the specified trajectory.
auto otv__stream_glyphs(const uint32_t traj_id, const uint32_t layer, const OTV_GlyphData* glyphs_data, const uint32_t num_glyphs) -> OTV_API void
Stream a number of glyph instances to the specified layer on the specified trajectory.

Defines

#define OTV_API_INCLUDED
When this symbol is defined, the OnTubeVis API is included the in the scope of the current compilation unit.

Function documentation

OTV_API bool otv__startup(const int argc, const char*const* argv)

Initializes and starts the OnTubeVis main event loop. Since startup can take a while, this call will not block. Use otv__wait_for_startup() to wait until the implementation is ready to receive commands and check if the initialization was actually successful.

Parameters
argc The number of arguments to pass to the internal launcher.
argv C-style array of C-style strings containing the arguments for the internal launcher. The provided memory pointed to by each item in argv is guaranteed to remain unchanged (hence it is declared const).
Returns true if the OnTubeVis implementation has started its initialization, false otherwise – most notably, if the implementation was already running when the call was made.

Control flow. OnTubeVis is typically its own application, and the CGV Framework used internally always operates under the assumption that it runs its own host process. To emulate this when using OnTubeVis as a module, the calling process must enter into the execution of OnTubeVis as if it was the operating system, i.e. it must hand off control to the main() function of the CGV Framework. This function handles all of that and hosts the OnTubeVis main loop in its own, specially spawned thread.

Arguments. We adopt the convention that the very first argument, required to contain the command name by the POSIX standard, should point to the library file containing the OnTubeVis service. otv__startup() will prepend this first argument automatically – the arguments passed to this function should only contain actual, functional args without the initial command name.

Arguments that the OnTubeVis implementation recognizes include all arguments known to the CGV Framework, as well as the following OnTubeVis-specific options:

OTV_API bool otv__wait_for_startup(void)

Waits until the startup process initiated by otv__startup() is complete and the OnTubeVis implementation can receive commands.

Returns true if the OnTubeVis implementation has successfully started, false if the startup was unsuccessful.

OTV_API OTV_TerminateResult otv__terminate(void)

Requests the OnTubeVis main event loop to terminate and shut down.

Returns The status after the termination request. See OTV_TerminateResult for details.

OTV_API const char* otv__get_module_filepath(void)

Reports the file path of the currently loaded OnTubeVis library file.

Returns A C-style string containing the filepath of the loaded library implementing the OnTubeVis API.

Can be used for setting the 0th command line argument to be passed to the OnTubeVis main() function in case the library was linked against directly. There should typically be no need to use this whatsoever, since the preferred way to launch the OnTubeVis implementation is otv__startup(), which takes care of this automatically. When using dlopen()-like functionality, this path will already be known a-priori by the client anyway, but it can be used to check the location of the library the module was loaded from by the OS during process startup.

OTV_API bool otv__start_vis_session(OTV_VisSetupHandle vis_setup)

Start the visualization with the given setup.

Parameters
vis_setup The visualization setup to use.
Returns true if the session could be started, false otherwise.

When this function returns successfully, clients may start streaming samples to the trajectories created during visualization setup. There can only be one session active at a time, hence there is no handle for the session started this way. A new session can be started (replacing the currently running one, if any) by calling otv__start_vis_session again with a new (or the same) setup.

OTV_API OTV_Vec2 otv__instantiate_Glyph(const uint32_t traj_id, const uint32_t layer, const OTV_GlyphData* data)

Instantiates the given glyph to calculate its geometry and returns its extents along the trajectory.

Parameters
traj_id The id of the trajectory to instantiate the glyph on.
layer The on-tube layer to instantiate the glyph on.
data The data to instantiate the glyph with.
Returns The extents of the given glyph relative to its anchor position. OTV_Vec2::x will contain the radius in trailing direction of the trajectory, and OTV_Vec2::y the radius in leading direction.

Requires an active visualization session to determine the static glyph parameters.

OTV_API void otv__stream_spline_node(const uint32_t traj_id, const OTV_HermiteNode* node, const OTV_SegmentArclen* arclen)

Stream a spline node (made up of position, tangent and a timestamp) to the indicated trajectory, when the active visualization is set up to not use smooth extrapolation.

Parameters
traj_id The trajectory to stream the node to.
node The Hermite node to stream.
arclen The approximate arclength parameterization of the segment between the most recent and this new node. In case of the very first sample in a trajectory, this parameter is ignored (it may be NULL).

To accommodate time-critical realtime processes, this function is "fire-and-forget", i.e. no checks will be done to determine whether the sample was processed successfully. Instead, the function will return immediatly after the command to add the sample was submitted.

Using this function on a setup that uses at least one extrapolation segment will cause the extrapolation to be point-like, i.e. all extrapolated nodes will be set to the position of the passed-in spline node.

OTV_API void otv__stream_spline_node_and_extrapol(const uint32_t traj_id, const OTV_HermiteNode* node, const OTV_SegmentArclen* arclen, const OTV_Extrapolation* extrapol)

Stream a spline node (made up of position, tangent and a timestamp) to the indicated trajectory, as well as the extrapolated path following the node that should be used for smooth position refreshes and displaying as-of-yet orphaned glyphs.

Parameters
traj_id The trajectory to stream the node to.
node The Hermite node to stream.
arclen The approximate arclength parameterization of the segment between the most recent and this new node. In case of the very first sample in a trajectory, this parameter is ignored (it may be NULL).
extrapol Pointer to an array of extrapolations forming the extrapolated path after the provided node. The number of elements pointed-to by this parameter must not be less than the number of extrapolated segments configured during setup.

To accommodate time-critical realtime processes, this function is "fire-and-forget", i.e. no checks will be done to determine whether the sample was processed successfully. Instead, the function will return immediately after the command to add the sample was submitted.

Using this function on a setup that uses no extrapolation segments will cause the provided extrapolation to be ignored.

OTV_API OTV_SegmentArclen otv__compute_arclen(const OTV_HermiteNode* node0, const OTV_HermiteNode* node1, const float sigma)

Compute an arc length parameterization for the given Hermite curve.

Parameters
node0 The start Hermite node of the curve.
node1 The end Hermite node of the curve.
sigma A constant offset to apply to the parameterization, e.g. for incorporating cumulative arc length over a whole spline up to node0 .
Returns An arc length parameterization for the input curve. See OTV_SegmentArclen for details.

The arc length up to the segment currently being parameterized, typically called sigma, can be provided as well, resulting in all values of s computed by the resulting parameterization being offset by this value.

The implementation will typically perform a numerical approximation from scratch, which is relatively slow (albeit fairly accurate). Consider using information available to you in your data to infer arc length instead of relying on this function.

OTV_API float otv__eval_arclen(const OTV_SegmentArclen* s, const float t)

Evaluate s(t), where s is defined by the coefficients of the provided arc length parameterization, to compute the arc length s at the given (time-like) curve parameter t.

Parameters
s The arc length parametrization to evaluate.
t The (time-like) curve parameter to evaluate the arc length for.
Returns s(t), i.e. the arc length s at curve parameter t.

The parameter t can be any number, but the arc length parameterization strategy used in the OnTubeVis API by construction only gives reliable results for t=0..1 on the corresponding segment, and can potentially even decrease again for t≥1 (or increase for t≤0)

OTV_API OTV_Vec3 otv__latlon_height_to_cartesian(const double latitude, const double longitude, const double height)

Obtain the Cartesian coordinates for the given set of latitude/longitude and height values. This is only available if a geo reference has been configured during setup.

Parameters
latitude The latitude of the position.
longitude The longitude of the position
height The height above the reference location, in meters.
Returns The Cartesian coordinates corresponding to the provided location, with the height in the y component. All components are in meters from the reference position.

OTV_API void otv__compute_extrapol(OTV_Extrapolation* out, const uint32_t num, const OTV_HermiteNode* ref_node0, const OTV_HermiteNode* ref_node1, const OTV_SegmentArclen* ref_arclen)

Create a primitive extrapolation with the desired number of segments given one reference Hermite segment to extrapolate from.

Parameters
out Pointer to an array of extrapolations large enough to hold num elements.
num The desired number of segments in the extrapolation. Must be at least 1.
ref_node0 The start Hermite node of the reference segment.
ref_node1 The end Hermite node of the reference segment.
ref_arclen The arc length re-parametrization of the reference segment.

It is up to the implementation how the extrapolation is done exactly. The OnTubeVis desktop application currently just adds perfectly straight segments with the same velocity as the end node of the provided segment.

OTV_API void otv__stream_glyph(const uint32_t traj_id, const uint32_t layer, const OTV_GlyphData* glyph_data)

Stream a single glyph instance to the specified layer on the specified trajectory.

Parameters
traj_id The trajectory to stream the glyph to.
layer The on-tube layer the glyph is for.
glyph_data The parameters for instantiating the glyph. Responsibility for making sure the proper specialization of the OTV_GlyphData struct is used for the specified layer lies with the caller.

To accomodate time-critical realtime processes, this function is "fire-and-forget", i.e. no checks will be done to determine whether the glyph was processed successfully. Instead, the function will return immediatly after the command to add the glyph was submitted.

OTV_API void otv__stream_glyphs(const uint32_t traj_id, const uint32_t layer, const OTV_GlyphData* glyphs_data, const uint32_t num_glyphs)

Stream a number of glyph instances to the specified layer on the specified trajectory.

Parameters
traj_id The trajectory to stream the glyphs to.
layer The on-tube layer the glyphs are for.
glyphs_data The parameters for instantiating the glyphs. Responsibility for making sure the proper specialization of the OTV_GlyphData struct is used for the specified layer lies with the caller.
num_glyphs The number of glyph instances pointed to by glyphs_data.

To accomodate time-critical realtime processes, this function is "fire-and-forget", i.e. no checks will be done to determine whether the glyphs were processed successfully. Instead, the function will return immediatly after the command to add the glyphs was submitted.