~ubuntu-branches/ubuntu/trusty/blender/trusty-proposed

« back to all changes in this revision

Viewing changes to source/blender/freestyle/intern/scene_graph/TriangleRep.cpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-08-14 10:43:49 UTC
  • mfrom: (14.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20130814104349-t1d5mtwkphp12dyj
Tags: 2.68a-3
* Upload to unstable
* debian/: python3.3 Depends simplified
  - debian/control: python3.3 Depends dropped
    for blender-data package
  - 0001-blender_thumbnailer.patch refreshed
* debian/control: libavcodec b-dep versioning dropped

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * ***** BEGIN GPL LICENSE BLOCK *****
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License
 
6
 * as published by the Free Software Foundation; either version 2
 
7
 * of the License, or (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software Foundation,
 
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 *
 
18
 * ***** END GPL LICENSE BLOCK *****
 
19
 */
 
20
 
 
21
/** \file blender/freestyle/intern/scene_graph/TriangleRep.cpp
 
22
 *  \ingroup freestyle
 
23
 *  \brief Class to define the represenation of a triangle
 
24
 *  \author Stephane Grabli
 
25
 *  \date 16/12/2002
 
26
 */
 
27
 
 
28
#include "TriangleRep.h"
 
29
 
 
30
namespace Freestyle {
 
31
 
 
32
void TriangleRep::ComputeBBox()
 
33
{
 
34
        real XMax = _vertices[0][0];
 
35
        real YMax = _vertices[0][1];
 
36
        real ZMax = _vertices[0][2];
 
37
 
 
38
        real XMin = _vertices[0][0];
 
39
        real YMin = _vertices[0][1];
 
40
        real ZMin = _vertices[0][2];
 
41
 
 
42
        // parse all the coordinates to find the XMax, YMax, ZMax
 
43
        for (int i = 0; i < 3; ++i) {
 
44
                // X
 
45
                if (_vertices[i][0] > XMax)
 
46
                        XMax = _vertices[i][0];
 
47
                if (_vertices[i][0] < XMin)
 
48
                        XMin = _vertices[i][0];
 
49
 
 
50
                // Y
 
51
                if (_vertices[i][1] > YMax)
 
52
                        YMax = _vertices[i][1];
 
53
                if (_vertices[i][1] < YMin)
 
54
                        YMin = _vertices[i][1];
 
55
 
 
56
                // Z
 
57
                if (_vertices[i][2] > ZMax)
 
58
                        ZMax = _vertices[i][2];
 
59
                if (_vertices[i][2] < ZMin)
 
60
                        ZMin = _vertices[i][2];
 
61
        }
 
62
 
 
63
        setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
 
64
}
 
65
 
 
66
} /* namespace Freestyle */