Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
trax::RoadwayTwist Struct Referenceabstract

A RoadwayTwist is used to define the actual rotating angle around the tangent at a curve to get the correct alignment to the lane. More...

#include <C:/Trend/Development/Trax3/Code/trax/RoadwayTwist.h>

Inheritance diagram for trax::RoadwayTwist:

Public Types

enum class  TwistType : char {
  Unknown = -2 , None = -1 , Zero = 0 , Constant ,
  Linear , Piecewise , PiecewiseLinear , PiecewiseCircular ,
  PiecewiseDirectional , Directional , Positional , Combined ,
  Parallel
}

Public Member Functions

virtual const char * TypeName () const noexcept=0
 Name for the object type that implements this interface.
virtual TwistType GetTwistType () const noexcept=0
virtual std::unique_ptr< RoadwayTwist > Clone () const =0
 Make a clone from this object.
virtual bool IsValid () const noexcept=0
virtual Angle Twist (Length s) const =0
virtual AnglePerLength D1 (Length s) const =0
virtual bool ZeroFlip (bool bActive) noexcept=0
virtual void Flip () noexcept=0
 Flips the effect of the twist along the track. After calling this function, the Twist() and D1() methods will give pi - Twist(Track::GetLength() - s) and -D1(Track::GetLength() - s). Calling Flip() a second time will nullify the effect.
virtual void Mirror () noexcept=0
 Multiplies all twist angle by -1.
virtual bool Offset (Angle offset) noexcept=0
 Adds a global offset angle to the Twist.
virtual bool IsDynamic () const noexcept=0
 A twist is dynamic if it relates to geometry global to the track.
virtual bool IsDirectionalConstant () const noexcept=0
 Find wether the twist is directional only offsetted by a constant.
virtual bool IsConstant () const noexcept=0
virtual void Freeze (bool bFreeze=true) noexcept=0
 Freezes the twist, so that dynamic twists like DirectionalTwist don't update anymore.
virtual bool IsFrozen () const noexcept=0
virtual bool IsNull () const noexcept=0
virtual bool Equals (const RoadwayTwist &toTwist, Angle epsilon_angle=epsilon__angle) const noexcept=0
 Comparison.
virtual void OnAttach (const TrackBuilder &track) noexcept=0
 Called on attachment to a track.
virtual void OnDetach () noexcept=0
 Called on detachment from a track.
virtual Angle DoTwist (Length) const =0
virtual AnglePerLength DoD1 (Length) const =0
 RoadwayTwist (RoadwayTwist &&)=delete
RoadwayTwist & operator= (const RoadwayTwist &)=delete
RoadwayTwist & operator= (RoadwayTwist &&)=delete

Static Public Member Functions

static dclspc std::unique_ptr< RoadwayTwist > Make (TwistType type) noexcept
 Makes a RoadwayTwist object.
static dclspc std::unique_ptr< RoadwayTwist > Make (TwistType type, const RoadwayTwist &fromTwist) noexcept
 Makes a RoadwayTwist object from another twist.

Protected Member Functions

 RoadwayTwist (const RoadwayTwist &)=default

Detailed Description

A RoadwayTwist is used to define the actual rotating angle around the tangent at a curve to get the correct alignment to the lane.

Member Enumeration Documentation

◆ TwistType

enum class trax::RoadwayTwist::TwistType : char
strong
Enumerator
Zero 

A twist that always applies 0_rad as a twist angle.

Constant 

A twist that applies a constant twist angle at every point along a track.

Linear 

A twist that linearly interpolates the twist angle from front to end of a track.

Piecewise 

A twist that applies different twist angles to segments long the track.

PiecewiseLinear 

A twist that interpolates the angles linearly along the segments.

PiecewiseCircular 

A twist that interpolates the angles in a 2pi interval and uses the shortest angular distance.

PiecewiseDirectional 

A twist that interpolates directions (slerp) and uses the result as directional twist.

Directional 

A twist that rotates the frame's B closest to some attractor vector.

Positional 

A twist that rotates the frame's B to point closest to some point in space.

Combined 

A twist that combines two twists additively.

Member Function Documentation

◆ D1()

virtual AnglePerLength trax::RoadwayTwist::D1 ( Length s) const
pure virtual
Parameters
strack parameter to get the derivative for [0,Track::GetLength()].
Returns
First derivative of twist.

◆ DoD1()

virtual AnglePerLength trax::RoadwayTwist::DoD1 ( Length ) const
pure virtual
Returns
The twist without ZeroFlip or addaptions for general flip.

◆ DoTwist()

virtual Angle trax::RoadwayTwist::DoTwist ( Length ) const
pure virtual
Returns
The twist without ZeroFlip or addaptions for general flip.

◆ Equals()

virtual bool trax::RoadwayTwist::Equals ( const RoadwayTwist & toTwist,
Angle epsilon_angle = epsilon__angle ) const
pure virtualnoexcept

Comparison.

Two twists of different types are considered not equal.

Returns
true if the twists are equal up to the given thresholds.
Parameters
toTwisttwist to compare with.
epsilon_anglemaximum vector rotational deviation.

◆ IsConstant()

virtual bool trax::RoadwayTwist::IsConstant ( ) const
pure virtualnoexcept
Returns
if the twist is constant in fact.

◆ IsDirectionalConstant()

virtual bool trax::RoadwayTwist::IsDirectionalConstant ( ) const
pure virtualnoexcept

Find wether the twist is directional only offsetted by a constant.

If this returns true, the relation:

/// t + dw/ds = k * AF.T/AF.B / (1 + pow<2>(AF.N/AF.B));
/// 

holds.

Returns
true if the twist is a directional twist or a constant twist or a combinatin of those.

◆ IsDynamic()

virtual bool trax::RoadwayTwist::IsDynamic ( ) const
pure virtualnoexcept

A twist is dynamic if it relates to geometry global to the track.

Directional or positional twists will be dynamic.

Returns
true if the twist will be updated on changing the track's pose.

◆ IsFrozen()

virtual bool trax::RoadwayTwist::IsFrozen ( ) const
pure virtualnoexcept
Returns
the freeze state of the twist. Non-dynamic twists will always return true.

◆ IsNull()

virtual bool trax::RoadwayTwist::IsNull ( ) const
pure virtualnoexcept
Returns
true if the twist is 0 at all s.

◆ IsValid()

virtual bool trax::RoadwayTwist::IsValid ( ) const
pure virtualnoexcept

Tests wether the twist was properly created.

A dynamic twist will only be valid after attaching it to a track.

Returns
true if the twist is able to deliver valid geometry.

◆ Mirror()

virtual void trax::RoadwayTwist::Mirror ( )
pure virtualnoexcept

Multiplies all twist angle by -1.

Note that some Twists like DirectionalTwist will not be able to compute such a mirror operation, due to their nature.

◆ Offset()

virtual bool trax::RoadwayTwist::Offset ( Angle offset)
pure virtualnoexcept

Adds a global offset angle to the Twist.

Note that some Twists like DirectionalTwist will not be able to compute such an offset, due to their nature.

Parameters
offsetangle to offset all twist values, returned by this twist.
Returns
true, if the offset was properly added, false if that could not be done.

◆ OnAttach()

virtual void trax::RoadwayTwist::OnAttach ( const TrackBuilder & track)
pure virtualnoexcept

Called on attachment to a track.

Parameters
trackTrack that the Twist is attached to.

◆ Twist()

virtual Angle trax::RoadwayTwist::Twist ( Length s) const
pure virtual
Parameters
strack parameter to get the twist for [0,Track::GetLength()].
Returns
Twisting angle in radiants.

Implemented in trax::PiecewiseDirectionalTwist, and trax::PiecewiseTwist.

◆ ZeroFlip()

virtual bool trax::RoadwayTwist::ZeroFlip ( bool bActive)
pure virtualnoexcept

Activates a rotation of pi around the tangent vector, if the curve attached to the track would transition a point of zero curvature and is flipping its main normal vector around. This counteracts the sudden turn of tracks up direction. Several zero curvature points along the curve are handled accordingly.

Parameters
bActiveif true, zero flip will be activated, which is the default if this makes sense for the twist.
Returns
The previous state of the flag.

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