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