HorizonSnapshot
public struct HorizonSnapshot
Snapshot of the horizon.
Horizon snapshot holds state of the horizon for HorizonOptions provided by user and
current position. Snapshot contains data such as:
- paths: List of
HorizonPathincluding at least 1 main path and optional subpaths - state: Current
HorizonSnapshotStateholding incremental counter of horizon updates - mainPathID: ID of current main path, nil if current position is offroad
Horizon snapshot can be extracted from HorizonResult, which can be obtained using
instance of HorizonEngine, registering set of HorizonOptions and making
call generateHorizon.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Initializes instance of
HorizonSnapshot.Declaration
Swift
public init( paths: [HorizonPath], state: HorizonSnapshotState, mainPathID: Int? )
-
The array of
HorizonPath, consisting of the main path and zero or more sub-paths. The main path is where the vehicle is located. A sub-path is any path in the horizon snapshot that is not the main path.Declaration
Swift
public let paths: [HorizonPath] -
The
HorizonSnapshotState.Declaration
Swift
public let state: HorizonSnapshotState -
Returns the main horizon path. The main path is the path on which the first on-road
HorizonPositionis located.Declaration
Swift
public func mainPath() -> HorizonPath?Return Value
Main
HorizonPath. Nil if there is no on-road position. -
Calculates the tree distance to the given horizon element from set position. Negative values indicate elements the vehicle has already passed. Positive values indicate elements ahead of the vehicle.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func distance( to element: HorizonElement, from position: HorizonPosition ) -> Measurement<UnitLength>?Return Value
The tree distance to the horizon element.
HorizonSnapshot Structure Reference