STLtriangle.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-2019 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::STLtriangle
26 
27 Description
28  A triangle representation for STL files.
29 
30 SourceFiles
31  STLtriangleI.H
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef STLtriangle_H
36 #define STLtriangle_H
37 
38 #include "STLpoint.H"
39 #include "Istream.H"
40 #include "Ostream.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of friend functions and operators
48 
49 class STLtriangle;
50 
51 Ostream& operator<<(Ostream&, const STLtriangle&);
52 
53 
54 /*---------------------------------------------------------------------------*\
55  Class STLtriangle Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class STLtriangle
59 {
60  // Private Data
61 
62  //- Attribute is 16-bit
63  typedef unsigned short STLattrib;
64 
65  //- The face normal, many programs write zore or other junk
66  STLpoint normal_;
67 
68  //- The three points defining the triangle
69  STLpoint a_, b_, c_;
70 
71  //- The attribute information could for colour or solid id, etc
72  STLattrib attrib_;
73 
74 
75 public:
76 
77  // Constructors
78 
79  //- Construct null
80  inline STLtriangle();
81 
82  //- Construct from components
83  inline STLtriangle
84  (
85  const STLpoint& normal,
86  const STLpoint& a,
87  const STLpoint& b,
88  const STLpoint& c,
89  unsigned short attrib
90  );
91 
92  //- Construct from istream (read binary)
93  inline STLtriangle(istream&);
94 
95 
96  // Member Functions
97 
98  // Access
99 
100  inline const STLpoint& normal() const;
101  inline const STLpoint& a() const;
102  inline const STLpoint& b() const;
103  inline const STLpoint& c() const;
104  inline unsigned short attrib() const;
105 
106 
107  // Read
108 
109  //- Read from istream (binary)
110  inline void read(istream&);
111 
112 
113  // Write
114 
115  //- Write to ostream (binary)
116  inline void write(ostream&);
117 
118 
119  // Ostream operator
120 
121  inline friend Ostream& operator<<(Ostream&, const STLtriangle&);
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace Foam
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #include "STLtriangleI.H"
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 #endif
136 
137 // ************************************************************************* //
const STLpoint & c() const
Definition: STLtriangleI.H:75
STLtriangle()
Construct null.
Definition: STLtriangleI.H:28
unsigned short attrib() const
Definition: STLtriangleI.H:81
const STLpoint & a() const
Definition: STLtriangleI.H:63
A triangle representation for STL files.
Definition: STLtriangle.H:57
friend Ostream & operator<<(Ostream &, const STLtriangle &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void write(ostream &)
Write to ostream (binary)
Definition: STLtriangleI.H:94
Ostream & operator<<(Ostream &, const ensightPart &)
const STLpoint & b() const
Definition: STLtriangleI.H:69
const STLpoint & normal() const
Definition: STLtriangleI.H:57
void read(istream &)
Read from istream (binary)
Definition: STLtriangleI.H:87
A vertex point representation for STL files.
Definition: STLpoint.H:48
Namespace for OpenFOAM.