chrono::geometry::ChLinePath Class Reference

Description

Geometric object representing an sequence of other ChLine objects, The ChLine objects are assumed to be properly concatenated and to have C0 continuity.

#include <ChLinePath.h>

Inheritance diagram for chrono::geometry::ChLinePath:
Collaboration diagram for chrono::geometry::ChLinePath:

Public Member Functions

 ChLinePath (const ChLinePath &source)
 
virtual ChLinePathClone () const override
 "Virtual" copy constructor (covariant return type).
 
virtual GeometryType GetClassType () const override
 Get the class type as unique numerical ID (faster than using ChronoRTTI mechanism). More...
 
virtual int Get_complexity ()
 
virtual double Length (int sampling) const override
 Return curve length. More...
 
virtual void Evaluate (ChVector<> &pos, const double parU, const double parV=0., const double parW=0.) const override
 Curve evaluation (only parU is used, in 0..1 range)
 
virtual ChVector GetEndA () const override
 Return the start point of the line.
 
virtual ChVector GetEndB () const override
 Return the end point of the line.
 
size_t GetSubLinesCount ()
 Get count of sub-lines that have been added:
 
std::shared_ptr< ChLineGetSubLineN (size_t n)
 Access the nth line.
 
double GetSubLineDurationN (size_t n)
 Get the nth line duration.
 
void SetSubLineDurationN (size_t n, double mduration)
 Set the nth line duration.
 
void AddSubLine (std::shared_ptr< ChLine > mline, double duration=1)
 Queue a line (push it back to the array of lines) More...
 
void AddSubLine (ChLine &mline, double duration=1)
 Queue a line (push it back to the array of lines) More...
 
void InsertSubLine (size_t n, std::shared_ptr< ChLine > mline, double duration=1)
 Insert a line at a specified index n in line array. More...
 
void InsertSubLine (size_t n, ChLine &mline, double duration=1)
 Insert a line at a specified index n in line array. More...
 
void EraseSubLine (size_t n)
 Erase a line from a specified index n in line array. More...
 
double GetPathDuration () const
 Tells the duration of the path, sum of the durations of all sub-lines. More...
 
void SetPathDuration (double mUduration)
 Shrink or stretch all the durations of the sub-lines so that the total duration of the path is equal to a specified value. More...
 
double GetContinuityMaxError () const
 Check if the path is topologically connected, i.e. More...
 
virtual void ArchiveOUT (ChArchiveOut &marchive) override
 
virtual void ArchiveIN (ChArchiveIn &marchive) override
 Method to allow de serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::geometry::ChLine
 ChLine (const ChLine &source)
 
virtual bool Get_closed () const
 Tell if the curve is closed.
 
virtual void Set_closed (bool mc)
 
virtual int Get_complexity () const
 Tell the complexity.
 
virtual void Set_complexity (int mc)
 
virtual int GetManifoldDimension () const override
 This is a line.
 
bool FindNearestLinePoint (ChVector<> &point, double &resU, double approxU, double tol) const
 Find the parameter resU for the nearest point on curve to "point".
 
double CurveCurveDist (ChLine *compline, int samples) const
 Returns adimensional information on "how much" this curve is similar to another in its overall shape (doesnot matter parametrization or start point). More...
 
double CurveSegmentDist (ChLine *complinesegm, int samples) const
 Same as before, but returns "how near" is complinesegm to whatever segment of this line (does not matter the percentual of line). More...
 
double CurveCurveDistMax (ChLine *compline, int samples) const
 Same as above, but instead of making average of the distances, these functions return the maximum of the distances... More...
 
double CurveSegmentDistMax (ChLine *complinesegm, int samples) const
 
virtual bool DrawPostscript (ChFile_ps *mfle, int markpoints, int bezier_interpolate)
 Draw into the current graph viewport of a ChFile_ps file.
 
- Public Member Functions inherited from chrono::geometry::ChGeometry
 ChGeometry (const ChGeometry &source)
 
virtual void GetBoundingBox (double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax, ChMatrix33<> *Rot=NULL) const
 Compute bounding box. More...
 
virtual void InflateBoundingBox (double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax, ChMatrix33<> *Rot=NULL) const
 Enlarge a previous existing bounding box. More...
 
virtual double Size () const
 Returns the radius of the sphere which can enclose the geometry.
 
virtual void Derive (ChVector<> &dir, const double parU, const double parV=0., const double parW=0.) const
 Evaluates a tangent versor on a geometry, given parametric coordinates, if possible. More...
 
virtual ChVector Baricenter () const
 Compute center of mass It should be overriden by inherited classes.
 
virtual void CovarianceMatrix (ChMatrix33<> &C) const
 Compute the 3x3 covariance matrix (only the diagonal and upper part) It should be overriden by inherited classes.
 
virtual void Update ()
 Generic update of internal data. More...
 

Public Attributes

std::vector< std::shared_ptr
< ChLine > > 
lines
 
std::vector< double > end_times
 
std::vector< double > durations
 

Additional Inherited Members

- Public Types inherited from chrono::geometry::ChGeometry
enum  GeometryType {
  NONE, SPHERE, BOX, CYLINDER,
  TRIANGLE, CAPSULE, CONE, LINE,
  LINE_ARC, LINE_BEZIER, LINE_CAM, LINE_PATH,
  LINE_POLY, LINE_SEGMENT, ROUNDED_BOX, ROUNDED_CYLINDER,
  ROUNDED_CONE, TRIANGLEMESH, TRIANGLEMESH_CONNECTED, TRIANGLEMESH_SOUP
}
 Enumeration of geometric objects.
 
- Protected Attributes inherited from chrono::geometry::ChLine
bool closed
 
int complexityU
 

Member Function Documentation

void chrono::geometry::ChLinePath::AddSubLine ( std::shared_ptr< ChLine mline,
double  duration = 1 
)

Queue a line (push it back to the array of lines)

Parameters
mlineline to add
durationduration of the abscyssa when calling the Evaluate() function
void chrono::geometry::ChLinePath::AddSubLine ( ChLine mline,
double  duration = 1 
)

Queue a line (push it back to the array of lines)

Parameters
mlineline to add
durationduration of the abscyssa when calling the Evaluate() function
void chrono::geometry::ChLinePath::EraseSubLine ( size_t  n)

Erase a line from a specified index n in line array.

Note that n cannot be higher than GetLineCount().

virtual GeometryType chrono::geometry::ChLinePath::GetClassType ( ) const
overridevirtual

Get the class type as unique numerical ID (faster than using ChronoRTTI mechanism).

Each inherited class must return an unique ID.

Reimplemented from chrono::geometry::ChLine.

double chrono::geometry::ChLinePath::GetContinuityMaxError ( ) const

Check if the path is topologically connected, i.e.

if all the sub lines are queued to have C0 continuity

double chrono::geometry::ChLinePath::GetPathDuration ( ) const

Tells the duration of the path, sum of the durations of all sub-lines.

This is useful because ifyou use the Evaluate() function on the path, the U parameter should range between 0 and the max duration.

void chrono::geometry::ChLinePath::InsertSubLine ( size_t  n,
std::shared_ptr< ChLine mline,
double  duration = 1 
)

Insert a line at a specified index n in line array.

Note that n cannot be higher than GetLineCount().

Parameters
nindex of line, 0 is first, etc.
mlineline to add
durationduration of the abscyssa when calling the Evaluate() function
void chrono::geometry::ChLinePath::InsertSubLine ( size_t  n,
ChLine mline,
double  duration = 1 
)

Insert a line at a specified index n in line array.

Note that n cannot be higher than GetLineCount().

Parameters
nindex of line, 0 is first, etc.
mlineline to add
durationduration of the abscyssa when calling the Evaluate() function
double chrono::geometry::ChLinePath::Length ( int  sampling) const
overridevirtual

Return curve length.

Sampling does not matter.

Reimplemented from chrono::geometry::ChLine.

void chrono::geometry::ChLinePath::SetPathDuration ( double  mUduration)

Shrink or stretch all the durations of the sub-lines so that the total duration of the path is equal to a specified value.

For example, you can normalize to 1 so you can use Evaluate() with U in the 0..1 range like with other lines.