CatmullRomSpline.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::CatmullRomSpline
26 
27 Description
28  An implementation of Catmull-Rom splines (sometimes known as Overhauser
29  splines). This is a piecewise cubic spline that intersects all of its
30  control points.
31 
32  In matrix form, the \e local interpolation on the interval t=[0..1] is
33  described as follows:
34 
35  \verbatim
36  P(t) = 1/2 * [ t^3 t^2 t 1 ] * [ -1 3 -3 1 ] * [ P-1 ]
37  [ 2 -5 4 -1 ] [ P0 ]
38  [ -1 0 1 0 ] [ P1 ]
39  [ 0 2 0 0 ] [ P2 ]
40  \endverbatim
41 
42  Where P-1 and P2 represent the neighbouring points or the extrapolated
43  end points. Reflection is used to automatically create the extrapolated end
44  points.
45 
46 See also
47  BSpline
48 
49 SourceFiles
50  CatmullRomSpline.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef CatmullRomSpline_H
55 #define CatmullRomSpline_H
56 
57 #include "Spline.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class CatmullRomSpline Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class CatmullRomSpline
69 :
70  public Spline<CatmullRomSpline>
71 {
72 public:
73 
74  // Constructors
75 
76  //- Inherit constructors
77  using Spline::Spline;
78 
79 
80  // Member Functions
81 
82  //- Return the point position corresponding to the segment parameter
83  point position(const label segmenti, const scalar segmentLambda) const;
84 
85  //- Inherit the base class' position methods
87 };
88 
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 } // End namespace Foam
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 #endif
97 
98 // ************************************************************************* //
An implementation of Catmull-Rom splines (sometimes known as Overhauser splines). This is a piecewise...
point position(const label segmenti, const scalar segmentLambda) const
Return the point position corresponding to the segment parameter.
Base class for splines.
Definition: Spline.H:51
Spline(const pointField &knots, const scalar tol, const label nIter)
Construct from components.
Definition: Spline.C:32
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59