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