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>
|
| enum class | TwistType : char {
Unknown = -2
, None = -1
, Zero = 0
, Constant
,
Linear
, Piecewise
, PiecewiseLinear
, PiecewiseCircular
,
PiecewiseDirectional
, Directional
, Positional
, Combined
,
Parallel
} |
|
|
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 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.
|
|
|
| RoadwayTwist (const RoadwayTwist &)=default |
A RoadwayTwist is used to define the actual rotating angle around the tangent at a curve to get the correct alignment to the lane.
◆ TwistType
| 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.
|
◆ D1()
- Parameters
-
- Returns
- First derivative of twist.
◆ DoD1()
- 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
-
| toTwist | twist to compare with. |
| epsilon_angle | maximum 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
-
| offset | angle 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
-
| track | Track that the Twist is attached to. |
◆ Twist()
| virtual Angle trax::RoadwayTwist::Twist |
( |
Length | s | ) |
const |
|
pure virtual |
◆ 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
-
| bActive | if 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: