OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

STLtriangle.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::STLtriangle
00027 
00028 Description
00029     A triangle representation for STL files.
00030 
00031 SourceFiles
00032     STLtriangleI.H
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef STLtriangle_H
00037 #define STLtriangle_H
00038 
00039 #include "STLpoint.H"
00040 #include "Istream.H"
00041 #include "Ostream.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                          Class STLtriangle Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 class STLtriangle
00053 {
00054     // Private data
00055 
00056         //- Attribute is 16-bit
00057         typedef unsigned short STLattrib;
00058 
00059         //- The face normal, many programs write zore or other junk
00060         STLpoint normal_;
00061 
00062         //- The three points defining the triangle
00063         STLpoint a_, b_, c_;
00064 
00065         //- The attribute information could for colour or solid id, etc
00066         STLattrib attrib_;
00067 
00068 
00069 public:
00070 
00071     // Constructors
00072 
00073         //- Construct null
00074         inline STLtriangle();
00075 
00076         //- Construct from components
00077         inline STLtriangle
00078         (
00079             const STLpoint& normal,
00080             const STLpoint& a,
00081             const STLpoint& b,
00082             const STLpoint& c,
00083             unsigned short attrib
00084         );
00085 
00086         //- Construct from istream (read binary)
00087         inline STLtriangle(istream&);
00088 
00089 
00090     // Member Functions
00091 
00092         // Access
00093 
00094             inline const STLpoint& normal() const;
00095             inline const STLpoint& a() const;
00096             inline const STLpoint& b() const;
00097             inline const STLpoint& c() const;
00098             inline unsigned short attrib() const;
00099 
00100 
00101         // Read
00102 
00103             //- Read from istream (binary)
00104             inline void read(istream&);
00105 
00106 
00107         // Write
00108 
00109             //- Write to ostream (binary)
00110             inline void write(ostream&);
00111 
00112 
00113     // Ostream operator
00114 
00115         inline friend Ostream& operator<<(Ostream&, const STLtriangle&);
00116 };
00117 
00118 
00119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00120 
00121 } // End namespace Foam
00122 
00123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00124 
00125 #include "STLtriangleI.H"
00126 
00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00128 
00129 #endif
00130 
00131 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd