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

Curves implement this interface that then can get attached to a track to define the tracks geometry. More...

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

Inheritance diagram for trax::Curve:

Public Types

enum class  CurveType {
  none = 0 , Line , Arc , Helix ,
  LineP , ArcP , HelixP , Clothoid ,
  Cubic , Spline , Rotator , RotatorWithOffset ,
  RotatorChain , PolygonalChain , SampledCurve , Parallel ,
  EEPCurve , EEPResidual , EEPAlternative , Unknown ,
  UserDefined
}
 Curve type identification values. More...

Public Member Functions

virtual const char * TypeName () const noexcept=0
virtual CurveType GetCurveType () const noexcept=0
virtual bool IsValid () const noexcept=0
virtual AnglePerLength Curvature (Length s) const =0
virtual AnglePerLength Torsion (Length s) const =0
virtual bool IsFlat () const noexcept=0
virtual void Transition (Length s, spat::Position< Length > &pos) const =0
 Copies the 3D Position at the specified location to pos.
virtual void Transition (Length s, spat::Vector< One > &tan) const =0
 Copies the 3D tangential vector at the specified location to tan.
virtual void Transition (Length s, spat::VectorBundle< Length, One > &bundle) const =0
 Copies the 3D Position and tangential vector at the specified location to bundle.
virtual void Transition (Length s, spat::VectorBundle2< Length, One > &bundle) const =0
 Copies the 3D Position and tangential and normal vectors at the specified location to bundle.
virtual void Transition (Length s, spat::Frame< Length, One > &frame) const =0
 Copies the 3D TBN-Frame at the specified location to frame.
virtual std::vector< LengthZeroSet () const =0
 Returns a list of parameters at which the normal vector flips from one side to the other.
virtual common::Interval< LengthRange () const =0
virtual spat::Vector< OneLocalUp () const =0
 Gives the Curve's idiosyncratic up direction. Some curves maintain some idea about where they have their upside, either because of their form (e.g Helix) or because it is extra defined (e.g. for Line). Some curves maintain no such notion (e.g. many Cubics).
virtual spat::Frame< Length, OneGetCurveLocalTransformation () const =0
virtual std::unique_ptr< Curve > Clone () const =0
 make an exact copy of this curve.
virtual bool Mirror (const spat::VectorBundle< Length, One > &mirrorPlane)=0
 Make a Curve with mirrored geometry (but of course one thet returns right handed frames).
virtual bool Equals (const Curve &toCurve, common::Interval< Length > range, Length epsilon_length=epsilon__length, Angle epsilon_angle=epsilon__angle) const =0
 Comparison.
 Curve (Curve &&)=delete
Curve & operator= (const Curve &)=delete
Curve & operator= (Curve &&)=delete

Protected Member Functions

 Curve (const Curve &)=default

Detailed Description

Curves implement this interface that then can get attached to a track to define the tracks geometry.

The curve has to be parametrized by its arc length to give correct results for train movement. Depending on the type of curve generally the parameter s might run from infinite negative to infinite positive value. A concrete curve has to get initialized by a create method and will not return usefull results until after calling the create method.

Member Enumeration Documentation

◆ CurveType

enum class trax::Curve::CurveType
strong

Curve type identification values.

Enumerator
Line 

A straight line.

Arc 

A circle circumferrence.

Helix 

A helix curve.

LineP 

A straight line with owned parameters.

ArcP 

A circle circumferrence with owned parameters.

HelixP 

A helix curve with owned parameters.

Clothoid 

An Euler spiral.

Cubic 

The solution for the curve given starting and ending points and tangent vectors.

Spline 

A series of cubics, generated from control points and tangents, also called 'Cubic Hermite Spline'.

Rotator 

A curve with linearly rotating tangent vector.

RotatorWithOffset 

A Rotator curve that starts with certain offset angles.

RotatorChain 

A series of connected Rotator curves.

PolygonalChain 

An ordered list of vertices with tangents.

SampledCurve 

An ordered list of F,k,t,s samples coming from a real curve that are used to numerically interpolate between them.

Parallel 

A Curve that is parallel to a given track.

EEPCurve 

The idiosyncratic curve type used by EEP. The parametrization of the curve is like in EEP, but in general it is not the arc length. (Produces the same wrong results as in EEP).

EEPResidual 

Arc length parametrized EEP curve, but only for u != 0, l!= 0 and k²+w² != 0.

EEPAlternative 

Alternative curve shape, but directly parametreized by arc length. Only for u != 0, l!= 0 and k²+w² != 0. For w == 0 this curves becomes identical to EEPResidual.

Member Function Documentation

◆ Clone()

virtual std::unique_ptr< Curve > trax::Curve::Clone ( ) const
pure virtual

make an exact copy of this curve.

Exceptions
std::bad_allocon memory exhaustion.

◆ Curvature()

virtual AnglePerLength trax::Curve::Curvature ( Length s) const
pure virtual
Parameters
sArc length parameter along the curve
Returns
The curvature of the curve at parameter s.

◆ Equals()

virtual bool trax::Curve::Equals ( const Curve & toCurve,
common::Interval< Length > range,
Length epsilon_length = epsilon__length,
Angle epsilon_angle = epsilon__angle ) const
pure virtual

Comparison.

Two curves of different types are considered not equal.

Returns
true if the geometry and absolute pose of this and the given curve are equal up to the given thresholds.
Parameters
toCurvecurve to compare with.
rangeParameter interval to compare at.
epsilon_lengthmaximum acceptable positional deviation.
epsilon_anglemaximum vector rotational deviation.

◆ GetCurveLocalTransformation()

virtual spat::Frame< Length, One > trax::Curve::GetCurveLocalTransformation ( ) const
pure virtual

If there is a definition of a 'standard curve' of the given type, e.g. defined as starting (s==0) in the origin with a tangent parallel to Ex<One> and a normal pointing in Ey<One> direction, this function returns the transformation from that standard curve to the real values returned by this curve. GetCurveLocalTransformation().FromParent() transforms this curve to the standard curve. The above mentioned standard curve is just an example (Transion( 0_m) would deliver the frame), the actual standard curve might be defined deifferently, e.g. for a helix it is an angle 'slope' between Ex<One> and the tangent.

◆ GetCurveType()

virtual CurveType trax::Curve::GetCurveType ( ) const
pure virtualnoexcept
Returns
Type that implements this interface.

◆ IsFlat()

virtual bool trax::Curve::IsFlat ( ) const
pure virtualnoexcept
Returns
true if it is guaranteed, that Torsion() will return 0_1Im for every s.

◆ IsValid()

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

Tests wether the curve was properly created.

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

◆ LocalUp()

virtual spat::Vector< One > trax::Curve::LocalUp ( ) const
pure virtual

Gives the Curve's idiosyncratic up direction. Some curves maintain some idea about where they have their upside, either because of their form (e.g Helix) or because it is extra defined (e.g. for Line). Some curves maintain no such notion (e.g. many Cubics).

Exceptions
std::runtime_errorif the Curve has no notion of up.
Returns
The Curve's up direction.

◆ Mirror()

virtual bool trax::Curve::Mirror ( const spat::VectorBundle< Length, One > & mirrorPlane)
pure virtual

Make a Curve with mirrored geometry (but of course one thet returns right handed frames).

Returns
false if no mirrored curve could be created for the curve type.

◆ Range()

virtual common::Interval< Length > trax::Curve::Range ( ) const
pure virtual

Some curves can only get evaluated at a certain parameter range. This is returned by the function, or {-infinite,infinite} if there is no intrinsic limit to the parameter value.

Exceptions
std::runtime_errorif the curve was not created yet.

◆ Torsion()

virtual AnglePerLength trax::Curve::Torsion ( Length s) const
pure virtual
Parameters
sArc length parameter along the curve
Returns
The torsion of the curve at parameter s.

◆ Transition() [1/5]

virtual void trax::Curve::Transition ( Length s,
spat::Frame< Length, One > & frame ) const
pure virtual

Copies the 3D TBN-Frame at the specified location to frame.

Parameters
sArc length parameter along the curve
frameTBN-Frame on curve at parameter s
Exceptions
std::out_of_rangeif s is not in the valid range of the curve.

◆ Transition() [2/5]

virtual void trax::Curve::Transition ( Length s,
spat::Position< Length > & pos ) const
pure virtual

Copies the 3D Position at the specified location to pos.

Parameters
sArc length parameter along the curve
posPosition on curve at parameter s
Exceptions
std::out_of_rangeif s is not in the valid range of the curve.

◆ Transition() [3/5]

virtual void trax::Curve::Transition ( Length s,
spat::Vector< One > & tan ) const
pure virtual

Copies the 3D tangential vector at the specified location to tan.

Parameters
sArc length parameter along the curve
tanTangent on curve at parameter s
Exceptions
std::out_of_rangeif s is not in the valid range of the curve.

◆ Transition() [4/5]

virtual void trax::Curve::Transition ( Length s,
spat::VectorBundle2< Length, One > & bundle ) const
pure virtual

Copies the 3D Position and tangential and normal vectors at the specified location to bundle.

Parameters
sArc length parameter along the curve
bundleVectorBundle on curve at parameter s
Exceptions
std::out_of_rangeif s is not in the valid range of the curve.

◆ Transition() [5/5]

virtual void trax::Curve::Transition ( Length s,
spat::VectorBundle< Length, One > & bundle ) const
pure virtual

Copies the 3D Position and tangential vector at the specified location to bundle.

Parameters
sArc length parameter along the curve
bundleVectorBundle on curve at parameter s
Exceptions
std::out_of_rangeif s is not in the valid range of the curve.

◆ TypeName()

virtual const char * trax::Curve::TypeName ( ) const
pure virtualnoexcept
Returns
Name for the type that implements this interface.

◆ ZeroSet()

virtual std::vector< Length > trax::Curve::ZeroSet ( ) const
pure virtual

Returns a list of parameters at which the normal vector flips from one side to the other.

In general for a curve the curvature might become zero. If this results in a rotation of the normal by pi, the parameter ist listed in the returned vector. No parameter is returned if the curvature gets zero without flipping the normal (e.g. for a straight line) The values are sorted by size.

Exceptions
std::runtime_errorif the curve was not created yet.

The documentation for this struct was generated from the following file:
  • C:/Trend/Development/Trax3/Code/trax/Curve.h