bezier.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015-2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::blockEdges::bezier
28 
29 Description
30  Nth order bezier curve edge. Only interior control points should be
31  specified. The outer points are taken as start and end. Note that the
32  calculation of each point takes 0(N^2) time, where N is the number of
33  control points. This edge type shouldn't therefore be used for finely
34  discretised line data; polyLine or similar will be more appropriate for
35  such cases. Beziers are useful for simple curved shapes such as aerofoils,
36  or when you want an edge to match a specific direction at one, or both, or
37  its endpoints. In comparison with BSplines, the grading of bezier edges
38  should be smoother, and the code is much simpler. The algorithmic order is
39  worse, however, and the edge will not follow the control points as closely.
40 
41 SourceFiles
42  bezier.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef blockEdges_bezier_H
47 #define blockEdges_bezier_H
48 
49 #include "blockEdge.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 namespace blockEdges
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class bezier Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class bezier
63 :
64  public blockEdge
65 {
66  // Private Data
67 
68  //- Control points
69  pointField control_;
70 
71 
72  // Private Member Functions
73 
74  //- No copy construct
75  bezier(const bezier&) = delete;
76 
77  //- No copy assignment
78  void operator=(const bezier&) = delete;
79 
80 
81 public:
82 
83  // Static data members
84  TypeName("bezier");
85 
86 
87  // Constructors
88 
89  //- Construct from components
90  bezier
91  (
92  const pointField& points,
93  const label start,
94  const label end,
95  const pointField& control
96  );
97 
98  //- Construct from Istream and point field.
99  bezier
100  (
101  const dictionary& dict,
102  const label index,
103  const searchableSurfaces& geometry,
104  const pointField& points,
105  Istream& is
106  );
107 
108 
109  //- Destructor
110  virtual ~bezier() = default;
111 
112 
113  // Member Functions
114 
115  //- Return the point position corresponding to the curve parameter
116  // 0 <= lambda <= 1
117  point position(const scalar lambda) const;
118 
119  //- Return the length of the curve
120  // \not NotImplemented
121  scalar length() const;
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace blockEdges
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
Foam::blockEdge::end
label end() const
Index of end point.
Definition: blockEdgeI.H:36
Foam::blockEdges::bezier::length
scalar length() const
Return the length of the curve.
Definition: bezier.C:98
Foam::blockEdge
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
Definition: blockEdge.H:62
Foam::blockEdges::bezier::TypeName
TypeName("bezier")
Foam::Field< vector >
Foam::blockEdges::bezier
Nth order bezier curve edge. Only interior control points should be specified. The outer points are t...
Definition: bezier.H:61
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::blockEdge::start
label start() const
Index of start point.
Definition: blockEdgeI.H:30
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
lambda
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
Foam::blockEdges::bezier::~bezier
virtual ~bezier()=default
Destructor.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Vector< scalar >
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::blockEdges::bezier::position
point position(const scalar lambda) const
Return the point position corresponding to the curve parameter.
Definition: bezier.C:79
blockEdge.H