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

A twist that rotates the frame arount T in a way that B is nearest a certain direction. More...

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

Inheritance diagram for trax::DirectionalTwist:

Public Types

using Data = spat::Vector<One>
Public Types inherited from trax::RoadwayTwist
enum class  TwistType : char {
  Unknown = -2 , None = -1 , Zero = 0 , Constant ,
  Linear , Piecewise , PiecewiseLinear , PiecewiseCircular ,
  PiecewiseDirectional , Directional , Positional , Combined ,
  Parallel
}

Public Member Functions

virtual void Attractor (const spat::Vector< One > &attractor)=0
 Set the direction for the twist.
virtual const spat::Vector< One > & Attractor () const noexcept=0
virtual const spat::Vector< One > & Attractor (bool bGlobal) const noexcept=0
virtual std::shared_ptr< const struct CurveGetCurve () const noexcept=0
virtual const Data & GetData () const noexcept=0
virtual void Create (const Data &data)=0
 Creates the twist from the data.
Public Member Functions inherited from trax::RoadwayTwist
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< DirectionalTwistMake (const spat::Vector< One > &attractor=Up) noexcept
 Makes a DirectionalTwist object.
static dclspc std::unique_ptr< DirectionalTwistMake (const RoadwayTwist &fromTwist) noexcept
 Makes a DirectionalTwist object from another twist.
Static Public Member Functions inherited from trax::RoadwayTwist
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.

Additional Inherited Members

Protected Member Functions inherited from trax::RoadwayTwist
 RoadwayTwist (const RoadwayTwist &)=default

Detailed Description

A twist that rotates the frame arount T in a way that B is nearest a certain direction.

The attractor is understood to be in the global or TrackSystem relative frame (if any). If the twist gets frozen, the attractor from then on will stay local to the track.

Member Function Documentation

◆ Attractor() [1/3]

virtual const spat::Vector< One > & trax::DirectionalTwist::Attractor ( ) const
pure virtualnoexcept

Normally this method returns the attractor in global coordinates, but in frozen state it will be relative to the track.

Returns
the attractor vector.

◆ Attractor() [2/3]

virtual const spat::Vector< One > & trax::DirectionalTwist::Attractor ( bool bGlobal) const
pure virtualnoexcept

This method returns the attractor in global or local coordinates.

Parameters
bGlobalIf true the attractor will be given in global coordinates; local coordinates, if false.
Returns
the attractor vector.

◆ Attractor() [3/3]

virtual void trax::DirectionalTwist::Attractor ( const spat::Vector< One > & attractor)
pure virtual

Set the direction for the twist.

The twist has to be reattached to a track, to make

Parameters
attractorThe vector to get approximated by the binormal vector in global coordinates
Exceptions
std::invalid_argumentif attractor is a null vector.
std::logic_errorIf the twist is already attached to a track.

◆ Create()

virtual void trax::DirectionalTwist::Create ( const Data & data)
pure virtual

Creates the twist from the data.

Exceptions
std::invalid_argumentif attractor is a null vector.
std::logic_errorIf the twist is already attached to a track.

◆ GetCurve()

virtual std::shared_ptr< const struct Curve > trax::DirectionalTwist::GetCurve ( ) const
pure virtualnoexcept
Returns
a pointer to the track's curve if attached, nullptr elsewise.

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