VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Attributes
DtLaneSegment Class Referencefinal

Description of one lane of a DtRoadSegment. Note: Because of the pointer arithmetic of this class within DtRoadDrivingLogic, subclassing DtLaneSegment is not supported and all functions in the class are non-virtual.

Classes

struct  DtLaneGeometry
 

Public Member Functions

 DtLaneSegment ()
 
 ~DtLaneSegment ()
 
 DtLaneSegment (const DtLaneSegment &orig)
 
DtLaneSegment & operator= (const DtLaneSegment &orig)
 
DtLaneSegment * clone ()
 
DtLaneGeometry & laneGeometry ()
 
const DtLaneGeometry & laneGeometry () const
 
DtTrafficControlDevice * trafficControlDevice ()
 
void setTrafficControlDevice (DtTrafficControlDevice *device)
 
int laneNumber () const
 
void setLaneNumber (const int lane)
 
DtRoadSegment * parentRoadSegment () const
 
void setParentRoadSegment (DtRoadSegment *parent)
 
Visualization Support

Get some vertices in local coordinates defining the lane, for the purposes of visualizing it.

void generateFirstHalfLanePoints (std::vector< DtVector > &pointList, bool drivingOnLeft, int pointsInCurve=5)
 
void generateSecondHalfLanePoints (std::vector< DtVector > &pointList, bool drivingOnLeft, int pointsInCurve=5)
 
Connecting Lane Access

Access connecting lanes. This is the lane in the downstream or upstream segment that this lane connects to. Note that roadSegment convention is used, so lane numbers start at 0 and go to # lanes-1.

If this value is -1, the lane does not connect to the next segment (this can happen if a 2-lane segment connects to a 1-lane segment for example, or in the future if each segment approaching an intersection connects to multiple downstream segments but not all lanes connect to all segments).

int connectingDownstreamLane () const
 
void setConnectingDownstreamLane (const int lane)
 
int connectingUpstreamLane () const
 
void setConnectingUpstreamLane (const int lane)
 
Geometry Calculation
double calculateInsideEntryCurveGeometry (double headingChange, double cosHeadingChange, double sinHeadingChange, bool debug=false)
 
void calculateEntryCurveGeometry (double segmentLeftEdgeRadius, double headingChange, bool debug=false)
 
double calculateInsideExitCurveGeometry (double segmentLeftEdgeRadius, double headingChange, double cosHeadingChange, double sinHeadingChange, bool debug=false)
 
void calculateExitCurveGeometry (double segmentLeftEdgeRadius, double headingChange, bool debug=false)
 

Protected Attributes

DtLaneGeometry myGeometry
 
DtTrafficControlDevice * myTrafficSignal
 
int myConnectingDownstreamLane
 
int myConnectingUpstreamLane
 
DtRoadSegment * myRoadSegment
 
int myLaneNumber
 

Constructor & Destructor Documentation

DtLaneSegment::DtLaneSegment ( )
DtLaneSegment::~DtLaneSegment ( )
DtLaneSegment::DtLaneSegment ( const DtLaneSegment &  orig)

Member Function Documentation

DtLaneSegment& DtLaneSegment::operator= ( const DtLaneSegment &  orig)
DtLaneSegment* DtLaneSegment::clone ( )
DtLaneGeometry& DtLaneSegment::laneGeometry ( )

Accessor for lane geometry. Geometry is changed by accessing this structure and changing fields.

const DtLaneGeometry& DtLaneSegment::laneGeometry ( ) const
DtTrafficControlDevice* DtLaneSegment::trafficControlDevice ( )

Not currently used (future work). Access traffic control device.

void DtLaneSegment::setTrafficControlDevice ( DtTrafficControlDevice *  device)

Not currently used (future work).

int DtLaneSegment::laneNumber ( ) const
inline
void DtLaneSegment::setLaneNumber ( const int  lane)
inline
DtRoadSegment* DtLaneSegment::parentRoadSegment ( ) const
inline
void DtLaneSegment::setParentRoadSegment ( DtRoadSegment *  parent)
inline
void DtLaneSegment::generateFirstHalfLanePoints ( std::vector< DtVector > &  pointList,
bool  drivingOnLeft,
int  pointsInCurve = 5 
)

Generate the entry curve and a point halfway down the lane. Points are generated in the right-most lane that continues from the previous segment.

Parameters
pointListA vector of points in local coordinates. This function adds new points to the end.
pointsInCurveis the number of points to use to approximate the entry and exit curves.
void DtLaneSegment::generateSecondHalfLanePoints ( std::vector< DtVector > &  pointList,
bool  drivingOnLeft,
int  pointsInCurve = 5 
)

Generate a point halfway down the lane and the exit curve. Points are generated in the right-most lane that continues to the next segment.

Parameters
pointListA vector of points in local coordinates. This function adds new points to the end.
pointsInCurveis the number of points to use to approximate the entry and exit curves.
int DtLaneSegment::connectingDownstreamLane ( ) const
inline
void DtLaneSegment::setConnectingDownstreamLane ( const int  lane)
inline
int DtLaneSegment::connectingUpstreamLane ( ) const
inline
void DtLaneSegment::setConnectingUpstreamLane ( const int  lane)
inline
double DtLaneSegment::calculateInsideEntryCurveGeometry ( double  headingChange,
double  cosHeadingChange,
double  sinHeadingChange,
bool  debug = false 
)

Calculate the entry curve geometry for the inside lane–that is, the lane that connects to the inside lane of the upstream segment. Inside lane means the one with the smallest arc radius. The radius of the curve is taken from the upstream lane info, since that was based on space available in this segment.

The function fills in elements of the myGeometry member.

Parameters
headingChangeThe change in heading from the previous segment, in radians (+ to the right). If driving on the left of the road, this value should be negated from the true rail segment geometry.
cosHeadingChangecos of heading change. A parameter to avoid repeated calculation.
sinHeadingChangesin of headingChange
debugA flag to generate verbose output on the sim console (DtWarn)
Returns
The corrected value of the segment left edge radius–it may be reduced from DtRoadSegment tmpGeometry due to space constraints for the curve. If the upstream exit curve has radius 0, the return value will be 0.
void DtLaneSegment::calculateEntryCurveGeometry ( double  segmentLeftEdgeRadius,
double  headingChange,
bool  debug = false 
)

Calculate the geometry of the entry curve for all lanes besides the inside lane. See calculateInsideEntryCurveGeometry.

The function fills in elements of the myGeometry member.

double DtLaneSegment::calculateInsideExitCurveGeometry ( double  segmentLeftEdgeRadius,
double  headingChange,
double  cosHeadingChange,
double  sinHeadingChange,
bool  debug = false 
)

Calculate the exit curve geometry for the inside lane.

This computes the actual radius of the curve and the offset–the distance before the end of the segment (the straight segment defined by the original rail segment) that the curve must begin. The offset is determined both by the radius of the curve and by the location of the intersection of the lane with the downstream lane.

The function compares this offset to the space available in this segment and the next and reduces the curve radius if necessary (even below the design vehicle minimum radius) to accommodate the space available. If there is zero space or less–possible if a segment is short relative to the width of the road–a zero radius will be used, resulting in the vehicle jumping to the next lane when it reaches the end of the segment.

The function uses values in the DtRoadSegment::DtTmpGeometry structure.

The function fills in elements of the myGeometry member.

Parameters
segmentLeftEdgeRadiusThe radius of a curve connecting the left edges of this segment and the next; assumed to have been calculated from constraints on the inside lane.
headingChangeThe change in heading to the next segment, in radians (+ to the right). If driving on the left of the road, this value should be negated from the true rail segment geometry.
cosHeadingChangecos of heading change. A parameter to avoid repeated calculation.
sinHeadingChangesin of headingChange
debugA flag to generate verbose output on the sim console (DtWarn)
Returns
The corrected value of the segment left edge radius–it may be reduced due to space constraints for the curve.
void DtLaneSegment::calculateExitCurveGeometry ( double  segmentLeftEdgeRadius,
double  headingChange,
bool  debug = false 
)

Calculate the geometry of the exit curve for all lanes besides the inside lane. See calculateInsideExitCurveGeometry.

The function fills in elements of the myGeometry member.

Member Data Documentation

DtLaneGeometry DtLaneSegment::myGeometry
protected
DtTrafficControlDevice* DtLaneSegment::myTrafficSignal
protected

Not currently used (future work); the traffic control device controlling traffic flow in the lane of the segment. May be static, e.g. a stop sign.

int DtLaneSegment::myConnectingDownstreamLane
protected

What lane this connects to in the downstream segment. RoadSegment lanes, ie 0-based numbering.

int DtLaneSegment::myConnectingUpstreamLane
protected

Upstream connecting lane.

DtRoadSegment* DtLaneSegment::myRoadSegment
protected

The road segment this lane belongs to.

int DtLaneSegment::myLaneNumber
protected

The array index of this lane in the road segment's array of lanes.


The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)