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-2021 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 edge& fromTo,
94  const pointField& control
95  );
96 
97  //- Construct from components
98  bezier
99  (
100  const pointField& points,
101  const label from,
102  const label to,
103  const pointField& control
104  );
105 
106  //- Construct from Istream and point field.
107  bezier
108  (
109  const dictionary& dict,
110  const label index,
111  const searchableSurfaces& /*unused*/,
112  const pointField& points,
113  Istream& is
114  );
115 
116 
117  //- Destructor
118  virtual ~bezier() = default;
119 
120 
121  // Member Functions
122 
123  //- Return the point position corresponding to the curve parameter
124  // 0 <= lambda <= 1
125  point position(const scalar lambda) const;
126 
127  //- Return the length of the curve
128  // \not NotImplemented
129  scalar length() const;
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace blockEdges
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:63
Foam::blockEdges::bezier::length
scalar length() const
Return the length of the curve.
Definition: bezier.C:109
Foam::blockEdge
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
Definition: blockEdge.H:63
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
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:123
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:90
blockEdge.H