API to gather information about the track and the cars state relative to the track. More...

Functions | |
| tdble | RtTrackGetWidth (tTrackSeg *seg, tdble toStart) |
| Get the track width at the specified point. | |
| void | RtTrackLocal2Global (tTrkLocPos *p, tdble *X, tdble *Y, int flag) |
| Calculate global coordinates from a local position relative to the given track segment (segment, toRight, toStart)The toStart position refers to the current segment, the function will not search for next segment if toStart is greater than the segment length. | |
| void | RtTrackGlobal2LocalD (tTrackSeg *segment, double X, double Y, tTrkLocPos *p, int type) |
| Convert global coordinates to a local track position using double intermediates. | |
| void | RtTrackGlobal2Local (tTrackSeg *segment, tdble X, tdble Y, tTrkLocPos *p, int type) |
| Convert global coordinates to a local track position. | |
| tdble | RtTrackHeightL (tTrkLocPos *p) |
| Returns the absolute height in meters of the road at the Local position p. | |
| tTrackSeg * | RtTrackGetSideNeighbourSeg (tTrackSeg *main, tTrackSeg *current, int tr_side) |
| Get the neighbour segment of the given current segment. | |
| tTrackSeg * | RtTrackGetSeg (tTrkLocPos *p) |
| Get the effective segment of the given position starting from a segment of type TR_MAIN, searching to the sides. | |
| tdble | RtTrackHeightG (tTrackSeg *seg, tdble X, tdble Y) |
| Returns the absolute height in meters of the road at the Global position (segment, X, Y) | |
| void | RtTrackSideNormalG (tTrackSeg *seg, tdble X, tdble Y, int side, t3Dd *norm) |
| Compute the horizontal inward border normal using the supplied segment. | |
| tdble | RtTrackSideTgAngleL (tTrkLocPos *p) |
| Used to get the tangent angle for a track position The angle is given in radian. | |
| void | RtTrackSurfaceNormalL (tTrkLocPos *p, t3Dd *norm) |
| Used to get the normal vector of the road (pointing upward). | |
| tdble | RtGetDistFromStart (tCarElt *car) |
| Get distance along the track from the start/finish line. | |
| tdble | RtGetDistFromStart2 (tTrkLocPos *p) |
| Get distance along the track from the start/finish line. | |
| int | RtDistToPit (struct CarElt *car, tTrack *track, tdble *dL, tdble *dW) |
| Get the distance to the pit stop. | |
API to gather information about the track and the cars state relative to the track.
Get the distance to the pit stop.
| [in] | car | The concerned car. |
| [in] | track | The current Track |
| [out] | dL | Non-NULL destination for forward longitudinal distance in meters, adjusted by one track length when outside [0, track length]. |
| [out] | dW | Non-NULL destination for pit.toRight - car.toRight in meters. |
Definition at line 692 of file rttrack.cpp.

Get distance along the track from the start/finish line.
| [in] | car | the concerned car. |
Definition at line 646 of file rttrack.cpp.

| tdble RtGetDistFromStart2 | ( | tTrkLocPos * | p | ) |
Get distance along the track from the start/finish line.
| [in] | p | Local position |
Definition at line 659 of file rttrack.cpp.
| tTrackSeg * RtTrackGetSeg | ( | tTrkLocPos * | p | ) |
Get the effective segment of the given position starting from a segment of type TR_MAIN, searching to the sides.
It does not search along the previous and next segments on the track. The supplied position is not modified.
| [in] | p | Current position relative to the main segment |
Definition at line 450 of file rttrack.cpp.

Get the neighbour segment of the given current segment.
This is required, because the lside and rside members only point to segments on the outside, the inside pointer is always NULL and this is implied in various code locations.
| [in] | main | Main segment owning current's side chain (TR_MAIN). |
| [in] | current | Segment to find the neighbour for |
| [in] | tr_side | Neighbour we are looking for, either left or right, TR_SIDE_LFT or TR_SIDE_RGT |
Definition at line 419 of file rttrack.cpp.

Get the track width at the specified point.
| [in] | seg | Segment |
| [in] | toStart | Distance from the beginning of the segment. The units are:
|
Definition at line 59 of file rttrack.cpp.
| void RtTrackGlobal2Local | ( | tTrackSeg * | segment, |
| tdble | X, | ||
| tdble | Y, | ||
| tTrkLocPos * | p, | ||
| int | type ) |
Convert global coordinates to a local track position.
Searches previous/next main segments starting at segment. Use a nearby main segment: this is a longitudinal search, not a global nearest-road query. toStart is in meters on straights and radians on curves; lateral distances are in meters. Positions outside the road are not clamped to its edges.
| [in] | segment | Main segment from which to start the search. |
| [in] | X | Global X coordinate in meters. |
| [in] | Y | Global Y coordinate in meters. |
| [out] | p | Non-NULL destination for segment, type and local coordinates. |
| [in] | type | TR_LPOS_MAIN for main-road coordinates; TR_LPOS_SEGMENT to resolve borders/sides and rebase lateral coordinates; TR_LPOS_TRACK to extend toRight/toLeft to the outer edges including sides (seg and toMiddle remain relative to the main road). |
Definition at line 298 of file rttrack.cpp.

| void RtTrackGlobal2LocalD | ( | tTrackSeg * | segment, |
| double | X, | ||
| double | Y, | ||
| tTrkLocPos * | p, | ||
| int | type ) |
Convert global coordinates to a local track position using double intermediates.
Searches previous/next main segments starting at segment. Use a nearby main segment: this is a longitudinal search, not a global nearest-road query. toStart is in meters on straights and radians on curves; lateral distances are in meters. Positions outside the road are not clamped to its edges.
| [in] | segment | Main segment from which to start the search. |
| [in] | X | Global X coordinate in meters. |
| [in] | Y | Global Y coordinate in meters. |
| [out] | p | Non-NULL destination for segment, type and local coordinates. |
| [in] | type | TR_LPOS_MAIN for main-road coordinates; TR_LPOS_SEGMENT to resolve borders/sides and rebase lateral coordinates; TR_LPOS_TRACK to extend toRight/toLeft to the outer edges including sides (seg and toMiddle remain relative to the main road). |
Definition at line 276 of file rttrack.cpp.

Returns the absolute height in meters of the road at the Global position (segment, X, Y)
| [in] | seg | Segment |
| [in] | X | Global X position |
| [in] | Y | Global Y position |
Definition at line 465 of file rttrack.cpp.

| tdble RtTrackHeightL | ( | tTrkLocPos * | p | ) |
Returns the absolute height in meters of the road at the Local position p.
The effective side segment is resolved and the lateral coordinate is rebased relative to that segment before calculating its height. If the point lies outside the track (and sides) the height is computed using the tangent to the banking of the segment (or side).
+ Point given
.^
. |
. |
. |
/ | height
/ |
______/ v
^ ^^ ^
| || |
track side
| [in] | p | Local position; valid segment and surface data are required. |
Definition at line 365 of file rttrack.cpp.

| void RtTrackLocal2Global | ( | tTrkLocPos * | p, |
| tdble * | X, | ||
| tdble * | Y, | ||
| int | flag ) |
Calculate global coordinates from a local position relative to the given track segment (segment, toRight, toStart)The toStart position refers to the current segment, the function will not search for next segment if toStart is greater than the segment length.
toStart represent an angle in radian for curves and a length in meters for straights.
| [in] | p | Local position |
| [out] | X | Global X position in meters; non-NULL output pointer. |
| [out] | Y | Global Y position in meters; non-NULL output pointer. |
| [in] | flag | Local position use:
|
Definition at line 81 of file rttrack.cpp.

Compute the horizontal inward border normal using the supplied segment.
The side parameter is used to indicate the right (TR_RGT) of the left (TR_LFT) side to consider. The Global position given (segment, X, Y) is used to project the point on the border, it is not necessary to give a point directly on the border itself. The horizontal components are normalized; the z component is not written.
| [in] | seg | Current segment |
| [in] | X | Global X position |
| [in] | Y | Global Y position |
| [in] | side | Side where the normal is wanted
|
| [in,out] | norm | Non-NULL vector: x/y receive the horizontal normal pointing into the track; z is left unchanged. Initialize z to zero before calling if a horizontal 3D vector is required. |
Definition at line 495 of file rttrack.cpp.
| tdble RtTrackSideTgAngleL | ( | tTrkLocPos * | p | ) |
Used to get the tangent angle for a track position The angle is given in radian.
Zero points along the global positive X axis; the result is not normalized.
| [in] | p | Local position |
Definition at line 539 of file rttrack.cpp.
| void RtTrackSurfaceNormalL | ( | tTrkLocPos * | p, |
| t3Dd * | norm ) |
Used to get the normal vector of the road (pointing upward).
Local coordinates are used to locate the point where to get the road normal vector. Uses a cross product of sampled segment chords, not an exact pointwise derivative. The result is normalized unless the sampled geometry is degenerate, in which case the zero vector is returned.
| [in] | p | Local position |
| [out] | norm | Non-NULL destination for the road normal. |
Definition at line 567 of file rttrack.cpp.
