2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19
* All rights reserved.
21
* The Original Code is: all of this file.
23
* Contributor(s): none yet.
25
* ***** END GPL LICENSE BLOCK *****
28
/** \file decimation/intern/LOD_MeshBounds.h
33
#ifndef __LOD_MESHBOUNDS_H__
34
#define __LOD_MESHBOUNDS_H__
36
#include "MEM_SmartPtr.h"
37
#include "LOD_MeshPrimitives.h"
38
#include "LOD_ManMesh2.h"
39
#include "MT_assert.h"
41
// simple class to compute the mesh bounds of a manifold mesh,
43
class LOD_MeshBounds {
51
MEM_SmartPtr<LOD_MeshBounds> output(new LOD_MeshBounds());
52
return output.Release();
57
const LOD_ManMesh2 * mesh
59
MT_assert(mesh!=NULL);
60
MT_assert(mesh->VertexSet().size() > 0);
62
const std::vector<LOD_Vertex> &verts = mesh->VertexSet();
67
// iterate through the verts
70
const int size = verts.size();
72
for (t=1; t< size ; ++t) {
74
UpdateBounds(verts[t].pos,m_min,m_max);
98
if (vertex.x() < min.x()) {
101
if (vertex.x() > max.x()) {
105
if (vertex.y() < min.y()) {
106
min.y() = vertex.y();
108
if (vertex.y() > max.y()) {
112
if (vertex.z() < min.z()) {
113
min.z() = vertex.z();
115
if (vertex.z() > max.z()) {