STLpoint.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::STLpoint
29 
30 Description
31  A vertex point or facet normal representation for STL files.
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef Foam_STLpoint_H
36 #define Foam_STLpoint_H
37 
38 #include "point.H"
39 #include "vector.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class STLpoint Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class STLpoint
51 :
52  public Vector<float>
53 {
54 public:
55 
56  // Constructors
57 
58  //- Default construct
59  STLpoint() = default;
60 
61  //- Construct from single-precision point
62  STLpoint(const Vector<float>& p)
63  :
64  Vector<float>(p)
65  {}
66 
67  //- Construct from double-precision point
68  STLpoint(const Vector<double>& p)
69  :
70  Vector<float>(float(p.x()), float(p.y()), float(p.z()))
71  {}
72 
73  //- Construct from single-precision components
74  STLpoint(float x, float y, float z)
75  :
76  Vector<float>(x, y, z)
77  {}
78 
79  //- Construct from double-precision components
80  STLpoint(double x, double y, double z)
81  :
82  Vector<float>(float(x), float(y), float(z))
83  {}
84 
85 
86  // Member Operators
87 
88  #ifdef WM_DP
89  //- Conversion to double-precision point
90  operator point() const
91  {
92  return point(x(), y(), z());
93  }
94  #endif
95 };
96 
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 } // End namespace Foam
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 #endif
105 
106 // ************************************************************************* //
STLpoint()=default
Default construct.
const float & y() const noexcept
Access to the vector y component.
Definition: Vector.H:140
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross-product operators.
Definition: Vector.H:58
const float & x() const noexcept
Access to the vector x component.
Definition: Vector.H:135
const float & z() const noexcept
Access to the vector z component.
Definition: Vector.H:145
vector point
Point is a vector.
Definition: point.H:37
volScalarField & p
A vertex point or facet normal representation for STL files.
Definition: STLpoint.H:43
STLpoint(const Vector< float > &p)
Construct from single-precision point.
Definition: STLpoint.H:59
Namespace for OpenFOAM.