Blender  V3.3
TriangleRep.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
8 #include "TriangleRep.h"
9 
10 namespace Freestyle {
11 
13 {
14  real XMax = _vertices[0][0];
15  real YMax = _vertices[0][1];
16  real ZMax = _vertices[0][2];
17 
18  real XMin = _vertices[0][0];
19  real YMin = _vertices[0][1];
20  real ZMin = _vertices[0][2];
21 
22  // parse all the coordinates to find the XMax, YMax, ZMax
23  for (int i = 0; i < 3; ++i) {
24  // X
25  if (_vertices[i][0] > XMax) {
26  XMax = _vertices[i][0];
27  }
28  if (_vertices[i][0] < XMin) {
29  XMin = _vertices[i][0];
30  }
31 
32  // Y
33  if (_vertices[i][1] > YMax) {
34  YMax = _vertices[i][1];
35  }
36  if (_vertices[i][1] < YMin) {
37  YMin = _vertices[i][1];
38  }
39 
40  // Z
41  if (_vertices[i][2] > ZMax) {
42  ZMax = _vertices[i][2];
43  }
44  if (_vertices[i][2] < ZMin) {
45  ZMin = _vertices[i][2];
46  }
47  }
48 
49  setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
50 }
51 
52 } /* namespace Freestyle */
Class to define the representation of a triangle.
virtual void setBBox(const BBox< Vec3f > &iBox)
Definition: Rep.h:135
virtual void ComputeBBox()
Definition: TriangleRep.cpp:12
VecMat::Vec3< real > Vec3r
Definition: Geom.h:28
inherits from class Rep
Definition: AppCanvas.cpp:18
double real
Definition: Precision.h:12