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