Blender  V2.93
LineRep.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 "LineRep.h"
23 
24 namespace Freestyle {
25 
27 {
28  real XMax = _vertices.front()[0];
29  real YMax = _vertices.front()[1];
30  real ZMax = _vertices.front()[2];
31 
32  real XMin = _vertices.front()[0];
33  real YMin = _vertices.front()[1];
34  real ZMin = _vertices.front()[2];
35 
36  // parse all the coordinates to find
37  // the XMax, YMax, ZMax
38  vector<Vec3r>::iterator v;
39  for (v = _vertices.begin(); v != _vertices.end(); ++v) {
40  // X
41  if ((*v)[0] > XMax) {
42  XMax = (*v)[0];
43  }
44  if ((*v)[0] < XMin) {
45  XMin = (*v)[0];
46  }
47 
48  // Y
49  if ((*v)[1] > YMax) {
50  YMax = (*v)[1];
51  }
52  if ((*v)[1] < YMin) {
53  YMin = (*v)[1];
54  }
55 
56  // Z
57  if ((*v)[2] > ZMax) {
58  ZMax = (*v)[2];
59  }
60  if ((*v)[2] < ZMin) {
61  ZMin = (*v)[2];
62  }
63  }
64 
65  setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
66 }
67 
68 } /* namespace Freestyle */
Class to define the representation of 3D Line.
ATTR_WARN_UNUSED_RESULT const BMVert * v
virtual void ComputeBBox()
Definition: LineRep.cpp:26
virtual void setBBox(const BBox< Vec3f > &iBox)
Definition: Rep.h:149
VecMat::Vec3< real > Vec3r
Definition: Geom.h:42
inherits from class Rep
Definition: AppCanvas.cpp:32
double real
Definition: Precision.h:26