2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2008-2022 Blender Authors
|
2023-06-14 23:30:43 +10:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-04-30 15:41:54 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup freestyle
|
|
|
|
|
* \brief Class to define the representation of 3D Line.
|
2012-12-28 20:21:05 +00:00
|
|
|
*/
|
2008-04-30 15:41:54 +00:00
|
|
|
|
|
|
|
|
#include "LineRep.h"
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
namespace Freestyle {
|
|
|
|
|
|
2008-04-30 15:41:54 +00:00
|
|
|
void LineRep::ComputeBBox()
|
|
|
|
|
{
|
2012-12-28 20:21:05 +00:00
|
|
|
real XMax = _vertices.front()[0];
|
|
|
|
|
real YMax = _vertices.front()[1];
|
|
|
|
|
real ZMax = _vertices.front()[2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
real XMin = _vertices.front()[0];
|
|
|
|
|
real YMin = _vertices.front()[1];
|
|
|
|
|
real ZMin = _vertices.front()[2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-17 17:05:14 +02:00
|
|
|
// parse all the coordinates to find
|
2012-12-28 20:21:05 +00:00
|
|
|
// the XMax, YMax, ZMax
|
|
|
|
|
vector<Vec3r>::iterator v;
|
|
|
|
|
for (v = _vertices.begin(); v != _vertices.end(); ++v) {
|
|
|
|
|
// X
|
2019-05-31 22:51:19 +10:00
|
|
|
if ((*v)[0] > XMax) {
|
2012-12-28 20:21:05 +00:00
|
|
|
XMax = (*v)[0];
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
|
|
|
|
if ((*v)[0] < XMin) {
|
2012-12-28 20:21:05 +00:00
|
|
|
XMin = (*v)[0];
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
// Y
|
2019-05-31 22:51:19 +10:00
|
|
|
if ((*v)[1] > YMax) {
|
2012-12-28 20:21:05 +00:00
|
|
|
YMax = (*v)[1];
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
|
|
|
|
if ((*v)[1] < YMin) {
|
2012-12-28 20:21:05 +00:00
|
|
|
YMin = (*v)[1];
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
// Z
|
2019-05-31 22:51:19 +10:00
|
|
|
if ((*v)[2] > ZMax) {
|
2012-12-28 20:21:05 +00:00
|
|
|
ZMax = (*v)[2];
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
|
|
|
|
if ((*v)[2] < ZMin) {
|
2012-12-28 20:21:05 +00:00
|
|
|
ZMin = (*v)[2];
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2012-12-28 20:21:05 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
|
2008-04-30 15:41:54 +00:00
|
|
|
}
|
2013-04-09 00:46:49 +00:00
|
|
|
|
|
|
|
|
} /* namespace Freestyle */
|