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

A series of samples of points and tangents that make up a curve. More...

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

Inheritance diagram for trax::PolygonalChain:

Public Types

enum class  WrapTypes { none = 0 , nonperiodic , periodic }
 Type of handling the ends:
using SegmentValueType = spat::VectorBundle<Length, One>
 Type of the segments.
using Data = std::vector<SegmentValueType>
Public Types inherited from trax::Curve
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 Length GetParameter (int idx) const =0
virtual int UpperBound (Length s) const =0
 The index of the polygonal vertex that is the first one to have greater parameter than s.
virtual const Data & GetData () const noexcept=0
 Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
Creation
virtual common::Interval< LengthCreate (const Curve &originalCurve, common::Interval< Length > range, Length maxDeviation, Length minPointDistance)=0
 Creates a polygonal chain from an existing curve.
virtual common::Interval< LengthCreate (std::pair< std::shared_ptr< const Curve >, common::Interval< Length > > originalCurve, Length maxDeviation, Length minPointDistance)=0
virtual common::Interval< LengthCreate (const std::vector< spat::Position< Length > > &samples, WrapTypes wrap=WrapTypes::nonperiodic)=0
 Creates a polygonal chain from a list of sample points.
virtual common::Interval< LengthCreateCatmullRom (const std::vector< spat::Position< Length > > &samples, WrapTypes wrap=WrapTypes::nonperiodic)=0
 Creates a polygonal chain from a list of sample points.
virtual common::Interval< LengthCreate (const Data &data)=0
 Create the curve from data set for which it is guaranteed, that no calculational drift will happen e.g. in write/read cycles.
Public Member Functions inherited from trax::Curve
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

Static Public Member Functions

static dclspc std::unique_ptr< PolygonalChainMake () noexcept
 Makes a PolygonalChain object.

Additional Inherited Members

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

Detailed Description

A series of samples of points and tangents that make up a curve.

The intermediate values for the TNB frame, curvature and torsion get linearly interpolated. The curve by definition is parametrized by arc length; the dynamic values in the sample points are calculated like this (see Serret-Frenet):

/// Pi, Ti; 
/// Ni = Normalize( (Ti+1 - Ti) - (Ti+1 - Ti) * Ti * Ti ) = Normalize( Ti+1 - Ti+1*Ti * Ti )
/// Bi = Ti % Ni
/// dsi = |Pi+1 - Pi|
/// ki = |Ti+1 - Ti| / dsi
/// ti = (Bi - Bi+1) * Ni / dsi
/// 

This curve interpolates the dynamic values of a real curve and is meant to be used if only some valid points (and maybe valid tangents) along a real curve are known. To sample a curve with known dynamic data use SampledCurve.

Member Function Documentation

◆ Create() [1/4]

virtual common::Interval< Length > trax::PolygonalChain::Create ( const Curve & originalCurve,
common::Interval< Length > range,
Length maxDeviation,
Length minPointDistance )
pure virtual

Creates a polygonal chain from an existing curve.

Parameters
originalCurvevalid template curve.
rangerange on the curve
maxDeviationthe maximum spacial deviation, so that the polygonal change is nowhere farther away from the original.
minPointDistancethe minimum distance of consecutive points. If this is to broad it might be not possoble to maintain maxDeviation.
Exceptions
std::invalid_argumentif originalCurve is not a valid curve, or the range of the curve does not intersect with range or maxDeviation <= 0_m.

◆ Create() [2/4]

virtual common::Interval< Length > trax::PolygonalChain::Create ( const Data & data)
pure virtual

Create the curve from data set for which it is guaranteed, that no calculational drift will happen e.g. in write/read cycles.

Exceptions
std::invalid_argumentif data.size() < 2 or data.size() == 2 and the two points are the same.

◆ Create() [3/4]

virtual common::Interval< Length > trax::PolygonalChain::Create ( const std::vector< spat::Position< Length > > & samples,
WrapTypes wrap = WrapTypes::nonperiodic )
pure virtual

Creates a polygonal chain from a list of sample points.

The tangents get created by Ti = Normalize( Pi+1 - Pi ).

Parameters
samplesList of sample points.
wrapType of wrapping the polygonal chain.
Exceptions
std::invalid_argumentif the curve can not created from the input values.

◆ Create() [4/4]

virtual common::Interval< Length > trax::PolygonalChain::Create ( std::pair< std::shared_ptr< const Curve >, common::Interval< Length > > originalCurve,
Length maxDeviation,
Length minPointDistance )
pure virtual
Parameters
originalCurvevalid template curve.
Exceptions
std::invalid_argumentif originalCurve is not a valid curve, or the range of the curve does not intersect with range or maxDeviation <= 0_m.
Parameters
maxDeviationthe maximum spacial deviation, so that the polygonal change is nowhere farther away from the original.
minPointDistancethe minimum distance of consecutive points. If this is to broad it might be not possoble to maintain maxDeviation.

◆ CreateCatmullRom()

virtual common::Interval< Length > trax::PolygonalChain::CreateCatmullRom ( const std::vector< spat::Position< Length > > & samples,
WrapTypes wrap = WrapTypes::nonperiodic )
pure virtual

Creates a polygonal chain from a list of sample points.

The tangents get created by Ti = Normalize( Pi+1 - Pi-1 ).

Parameters
samplesList of sample points.
wrapType of wrapping the polygonal chain.
Exceptions
std::invalid_argumentif the curve can not created from the input values.

◆ GetParameter()

virtual Length trax::PolygonalChain::GetParameter ( int idx) const
pure virtual
Returns
the parameter value at vertex idx.
Exceptions
std::out_of_rangeif idx is out of range.

◆ UpperBound()

virtual int trax::PolygonalChain::UpperBound ( Length s) const
pure virtual

The index of the polygonal vertex that is the first one to have greater parameter than s.

The index might become greater than GetData().size() - 1, in what case s is beyond the curves range.

Returns
the index of the first vertex that has a parameter value greater then s.

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