chrono::ChLineNurbs Class Reference

Description

Geometric object representing a NURBS spline.

#include <ChLineNurbs.h>

Inheritance diagram for chrono::ChLineNurbs:
Collaboration diagram for chrono::ChLineNurbs:

Public Member Functions

 ChLineNurbs ()
 Constructor. By default, a segment (order = 1, two points on X axis, at -1, +1)
 
 ChLineNurbs (int order, const std::vector< ChVector3d > &points, const ChVectorDynamic<> *knots=nullptr, const ChVectorDynamic<> *weights=nullptr)
 Constructor from a given array of control points. More...
 
 ChLineNurbs (const ChLineNurbs &source)
 
virtual ChLineNurbsClone () const override
 "Virtual" copy constructor (covariant return type).
 
virtual int GetComplexity () const override
 Get the complexity.
 
virtual ChVector3d Evaluate (double U) const override
 Return a point on the line, given parametric coordinate U (in [0,1]).
 
virtual ChVector3d GetTangent (double parU) const override
 Return the tangent unit vector at the parametric coordinate U (in [0,1]).
 
double ComputeUfromKnotU (double u) const
 When using Evaluate() etc. More...
 
double ComputeKnotUfromU (double U) const
 When using Evaluate() etc. More...
 
std::vector< ChVector3d > & Points ()
 Access the points.
 
ChVectorDynamicWeights ()
 Access the weights.
 
ChVectorDynamicKnots ()
 Access the knots.
 
int GetOrder ()
 Get the order of spline.
 
virtual void Setup (int order, const std::vector< ChVector3d > &points, const ChVectorDynamic<> *knots=nullptr, const ChVectorDynamic<> *weights=nullptr)
 Initial easy setup from a given array of control points. More...
 
virtual void ArchiveOut (ChArchiveOut &archive_out) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIn (ChArchiveIn &archive_in) override
 Method to allow de-serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChLine
 ChLine (const ChLine &source)
 
virtual Type GetType () const override
 "Virtual" copy constructor (covariant return type). More...
 
virtual bool IsClosed () const
 Get if the curve is closed.
 
virtual void SetClosed (bool mc)
 
virtual void SetComplexity (int mc)
 
virtual int GetManifoldDimension () const override
 Return dimensionality of this object. More...
 
bool FindNearestLinePoint (const ChVector3d &point, double &resU, double approxU, double tol) const
 Find the parameter resU for the nearest point on curve to "point".
 
virtual double Length (int sampling) const
 Returns curve length. Typical sampling 1..5 (1 already gives correct result with degree1 curves).
 
virtual ChVector3d GetEndA () const
 Return the start point of the line. More...
 
virtual ChVector3d GetEndB () const
 Return the end point of the line. More...
 
double CurveCurveDist (const ChLine *compline, int samples) const
 Return adimensional information on "how much" this curve is similar to another in its overall shape. More...
 
double CurveSegmentDist (const 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 (const ChLine *compline, int samples) const
 Same as above, but instead of making average of the distances, these functions return the maximum of the distances.
 
double CurveSegmentDistMax (const ChLine *complinesegm, int samples) const
 
- Public Member Functions inherited from chrono::ChGeometry
 ChGeometry (const ChGeometry &other)
 
virtual ChAABB GetBoundingBox () const
 Compute bounding box along the directions of the shape definition frame. More...
 
void InflateBoundingBox (ChAABB &bbox) const
 Enlarge the given existing bounding box with the bounding box of this object.
 
virtual double GetBoundingSphereRadius () const
 Returns the radius of a bounding sphere for this geometry. More...
 
virtual ChVector3d Barycenter () const
 Compute center of mass.
 
virtual void Update ()
 Generic update of internal data.
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ ChLineNurbs()

chrono::ChLineNurbs::ChLineNurbs ( int  order,
const std::vector< ChVector3d > &  points,
const ChVectorDynamic<> *  knots = nullptr,
const ChVectorDynamic<> *  weights = nullptr 
)

Constructor from a given array of control points.

Input data is copied. If the knots are not provided, a uniformly spaced knot vector is made. If the weights are not provided, a constant weight vector is made.

Parameters
orderorder p: 1= linear, 2=quadratic, etc.
pointscontrol points, size n. Required: at least n >= p+1
knotsknots, size k. Required k=n+p+1. If not provided, initialized to uniform.
weightsweights, size w. Required w=n. If not provided, all weights as 1.

Member Function Documentation

◆ ComputeKnotUfromU()

double chrono::ChLineNurbs::ComputeKnotUfromU ( double  U) const

When using Evaluate() etc.

you need U parameter to be in 0..1 range, but knot range is not necessarily in 0..1. So you can convert U->u, where u is in knot range, by calling this.

◆ ComputeUfromKnotU()

double chrono::ChLineNurbs::ComputeUfromKnotU ( double  u) const

When using Evaluate() etc.

you need U parameter to be in 0..1 range, but knot range is not necessarily in 0..1. So you can convert u->U, where u is in knot range, by calling this.

◆ Setup()

void chrono::ChLineNurbs::Setup ( int  order,
const std::vector< ChVector3d > &  points,
const ChVectorDynamic<> *  knots = nullptr,
const ChVectorDynamic<> *  weights = nullptr 
)
virtual

Initial easy setup from a given array of control points.

Input data is copied. If the knots are not provided, a uniformly spaced knot vector is made. If the weights are not provided, a constant weight vector is made.

Parameters
orderorder p: 1= linear, 2=quadratic, etc.
pointscontrol points, size n. Required: at least n >= p+1
knotsknots, size k. Required k=n+p+1. If not provided, initialized to uniform.
weightsweights, size w. Required w=n. If not provided, all weights as 1.

The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/geometry/ChLineNurbs.h
  • /builds/uwsbel/chrono/src/chrono/geometry/ChLineNurbs.cpp