3 * ***** BEGIN GPL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20 * All rights reserved.
22 * The Original Code is: all of this file.
24 * Contributor(s): none yet.
26 * ***** END GPL LICENSE BLOCK *****
29 #include "BSP_MeshPrimitives.h"
31 #include "MT_assert.h"
32 #include "BSP_CSGException.h"
62 vector<BSP_EdgeInd>::iterator result = find(m_edges.begin(),m_edges.end(),e);
63 if (result == m_edges.end()) {
66 BSP_EdgeInd last = m_edges.back();
68 if (m_edges.empty()) return true;
88 vector<BSP_EdgeInd>::iterator result =
89 find(m_edges.begin(),m_edges.end(),e_old);
90 if (result == m_edges.end()) {
91 BSP_CSGException e(e_mesh_error);
131 * Edge Primitive Methods.
137 m_verts[0] = m_verts[1] = BSP_VertexInd::Empty();
145 // edges are the same if their vertex indices are the
146 // same!!! Other properties are not checked
150 if (this->m_verts[0] == rhs.m_verts[0]) {
153 if (this->m_verts[1] == rhs.m_verts[0]) {
156 if (this->m_verts[0] == rhs.m_verts[1]) {
159 if (this->m_verts[1] == rhs.m_verts[1]) {
175 vector<BSP_FaceInd>::iterator result =
176 find(m_faces.begin(),m_faces.end(),old_f);
177 if (result == m_faces.end()) {
178 BSP_CSGException e(e_mesh_error);
191 if (vi == m_verts[0]) return m_verts[1];
192 if (vi == m_verts[1]) return m_verts[0];
194 BSP_CSGException e(e_mesh_error);
197 return BSP_VertexInd::Empty();
204 return bool(m_verts[1].Tag() & 0x1);
211 m_verts[1].SetTag(int(tag));
218 return m_verts[0].Tag();
226 // Note conversion from int to unsigned int!!!!!
227 m_verts[0].SetTag(tag);
232 * Face primitive methods
250 // TODO replace reverse as I think some compilers
251 // do not support the STL routines employed.
266 return bool(m_verts[1].Tag() & 0x1);
274 m_verts[1].SetTag(int(tag));
289 // Note conversion from int to unsigned int!!!!!