FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::STLtriangle
00026 
00027 Description
00028     A triangle representation for STL files.
00029 
00030 SourceFiles
00031     STLtriangleI.H
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef STLtriangle_H
00036 #define STLtriangle_H
00037 
00038 #include "STLpoint.H"
00039 #include <OpenFOAM/Istream.H>
00040 #include <OpenFOAM/Ostream.H>
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                          Class STLtriangle Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 class STLtriangle
00052 {
00053     // Private data
00054 
00055         //- Attribute is 16-bit
00056         typedef unsigned short STLattrib;
00057 
00058         //- The face normal, many programs write zore or other junk
00059         STLpoint normal_;
00060 
00061         //- The three points defining the triangle
00062         STLpoint a_, b_, c_;
00063 
00064         //- The attribute information could for colour or solid id, etc
00065         STLattrib attrib_;
00066 
00067 
00068 public:
00069 
00070     // Constructors
00071 
00072         //- Construct null
00073         inline STLtriangle();
00074 
00075         //- Construct from components
00076         inline STLtriangle
00077         (
00078             const STLpoint& normal,
00079             const STLpoint& a,
00080             const STLpoint& b,
00081             const STLpoint& c,
00082             unsigned short attrib
00083         );
00084 
00085         //- Construct from istream (read binary)
00086         inline STLtriangle(istream&);
00087 
00088 
00089     // Member Functions
00090 
00091         // Access
00092 
00093             inline const STLpoint& normal() const;
00094             inline const STLpoint& a() const;
00095             inline const STLpoint& b() const;
00096             inline const STLpoint& c() const;
00097             inline unsigned short attrib() const;
00098 
00099 
00100         // Read
00101 
00102             //- Read from istream (binary)
00103             inline void read(istream&);
00104 
00105 
00106         // Write
00107 
00108             //- Write to ostream (binary)
00109             inline void write(ostream&);
00110 
00111 
00112     // Ostream operator
00113 
00114         inline friend Ostream& operator<<(Ostream&, const STLtriangle&);
00115 };
00116 
00117 
00118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00119 
00120 } // End namespace Foam
00121 
00122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00123 
00124 #include "STLtriangleI.H"
00125 
00126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00127 
00128 #endif
00129 
00130 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines