1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 Foam::BSpline::BSpline
33 const pointField& knots,
37 polyLine(knots, closed)
41 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43 Foam::point Foam::BSpline::position(const scalar mu) const
48 return points().first();
50 else if (mu > 1 - SMALL)
52 return points().last();
56 label segment = localParameter(lambda);
57 return position(segment, lambda);
61 Foam::point Foam::BSpline::position
70 return points().first();
72 else if (segment > nSegments())
74 return points().last();
77 const point& p0 = points()[segment];
78 const point& p1 = points()[segment+1];
80 // special cases - no calculation needed
91 // determine the end points
97 // end: simple reflection
102 e0 = points()[segment-1];
105 if (segment+1 == nSegments())
107 // end: simple reflection
112 e1 = points()[segment+2];
124 ( 3*e0 - 6*p0 + 3*p1 )
126 ( -e0 + 3*p0 - 3*p1 + e1 )
133 Foam::scalar Foam::BSpline::length() const
135 notImplemented("BSpline::length() const");
140 // ************************************************************************* //