triPoints.H 2.68 KB
Newer Older
1
2
3
4
5
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
6
     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Class
25
    Foam::triPoints
26
27

Description
28
29
30
31
    Triangle storage. Null constructable (unfortunately triangle<point, point>
    is not)

SourceFiles
32
33
34

\*---------------------------------------------------------------------------*/

35
36
#ifndef triPoints_H
#define triPoints_H
37

38
39
#include "FixedList.H"
#include "treeBoundBox.H"
40
41
42
43
44
45
46

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

/*---------------------------------------------------------------------------*\
47
                          Class triPoints Declaration
48
49
\*---------------------------------------------------------------------------*/

50
class triPoints
51
:
52
    public FixedList<point, 3>
53
54
55
56
57
{
public:

    // Constructors

58
59
60
61
62
63
        //- Construct null
        inline triPoints()
        {}

        //- Construct from points
        inline triPoints
64
        (
65
66
67
            const point& a,
            const point& b,
            const point& c
68
69
        )
        {
70
71
72
            operator[](0) = a;
            operator[](1) = b;
            operator[](2) = c;
73
74
75
76
77
        }


    // Member Functions

78
79
        //- Calculate the bounding box
        inline treeBoundBox bounds() const
80
        {
81
82
            treeBoundBox bb(operator[](0));
            for (label i = 1; i < size(); ++i)
83
            {
84
                bb.add(operator[](i));
85
86
            }
            return bb;
87
88
89
        }
};

90

91
92
93
94
95
96
97
98
99
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //