An implementation of B-splines. More...
Public Member Functions | |
BSpline (const pointField &knots, const bool notImplementedClosed=false) | |
Construct from components. More... | |
point | position (const scalar lambda) const |
Return the point position corresponding to the curve parameter. More... | |
point | position (const label segment, const scalar lambda) const |
Return the point position corresponding to the local parameter. More... | |
scalar | length () const |
Return the length of the curve. More... | |
![]() | |
polyLine (const pointField &, const bool notImplementedClosed=false) | |
Construct from components. More... | |
const pointField & | points () const |
Return const-access to the control-points. More... | |
label | nSegments () const |
Return the number of line segments. More... | |
point | position (const scalar) const |
Return the point position corresponding to the curve parameter. More... | |
point | position (const label segment, const scalar) const |
Return the point position corresponding to the local parameter. More... | |
scalar | length () const |
Return the length of the curve. More... | |
Private Member Functions | |
BSpline (const BSpline &) | |
Disallow default bitwise copy construct. More... | |
void | operator= (const BSpline &) |
Disallow default bitwise assignment. More... | |
Additional Inherited Members | |
![]() | |
void | calcParam () |
Precalculate the rational cumulative parameter value. More... | |
label | localParameter (scalar &lambda) const |
Return the line segment and the local parameter [0..1]. More... | |
![]() | |
pointField | points_ |
The control points or ends of each segments. More... | |
scalar | lineLength_ |
The real line length. More... | |
scalarList | param_ |
The rational (0-1) cumulative parameter value for each point. More... | |
An implementation of B-splines.
In this implementation, the end tangents are created automatically by reflection.
In matrix form, the local interpolation on the interval t=[0..1] is described as follows:
P(t) = 1/6 * [ t^3 t^2 t 1 ] * [ -1 3 -3 1 ] * [ P-1 ] [ 3 -6 3 0 ] [ P0 ] [ -3 0 3 0 ] [ P1 ] [ 1 4 1 0 ] [ P2 ]
Where P-1 and P2 represent the neighbouring points or the extrapolated end points. Simple reflection is used to automatically create the end points.
The spline is discretized based on the chord length of the individual segments. In rare cases (sections with very high curvatures), the resulting distribution may be sub-optimal.
A future implementation could also handle closed splines.
BSpline | ( | const pointField & | knots, |
const bool | notImplementedClosed = false |
||
) |
|
private |
Disallow default bitwise assignment.
Foam::point position | ( | const scalar | lambda | ) | const |
Return the point position corresponding to the curve parameter.
0 <= lambda <= 1
Definition at line 43 of file BSpline.C.
References lambda(), polyLine::localParameter(), Foam::constant::physicoChemical::mu, and polyLine::points().
Referenced by main(), and BSplineEdge::position().
Foam::point position | ( | const label | segment, |
const scalar | lambda | ||
) | const |
Return the point position corresponding to the local parameter.
0 <= lambda <= 1 on the given segment
Definition at line 62 of file BSpline.C.
References Foam::constant::physicoChemical::mu, and points.
Foam::scalar length | ( | ) | const |
Return the length of the curve.
Definition at line 133 of file BSpline.C.
References NotImplemented.
Referenced by BSplineEdge::length().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.