forked from bartvdbraak/blender
Tools
----- Minor changes to boolean code; add an new include file to gather various #defines global to the boolean system. Currently, this just allows control of whether some debugging code is compiled or not. This is a precursor commit for some other boolean optimizations/cleanups. But in case that commit is later reverted, this code should still remain.
This commit is contained in:
parent
01b1bd4901
commit
1b78333087
@ -75,4 +75,19 @@ void BOP_Edge::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex)
|
||||
else if (m_vertexs[1] == oldIndex) m_vertexs[1] = newIndex;
|
||||
}
|
||||
|
||||
#ifdef BOP_DEBUG
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* Implements operator <<.
|
||||
*/
|
||||
ostream &operator<<(ostream &stream, BOP_Edge *e)
|
||||
{
|
||||
stream << "Edge[" << e->getVertex1() << "," << e->getVertex2();
|
||||
return stream;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#define BOP_EDGE_H
|
||||
|
||||
#include "BOP_Indexs.h"
|
||||
#include "BOP_Misc.h"
|
||||
|
||||
class BOP_Edge
|
||||
{
|
||||
@ -47,6 +48,10 @@ public:
|
||||
inline unsigned int getNumFaces(){return m_faces.size();};
|
||||
inline BOP_Indexs &getFaces(){return m_faces;};
|
||||
void addFace(BOP_Index face);
|
||||
#ifdef BOP_DEBUG
|
||||
friend ostream &operator<<(ostream &stream, BOP_Edge *e);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -402,6 +402,7 @@ bool BOP_Face4::getEdgeIndex(BOP_Index v1, BOP_Index v2, unsigned int &e)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef BOP_DEBUG
|
||||
/**
|
||||
* Implements operator <<.
|
||||
*/
|
||||
@ -421,3 +422,4 @@ ostream &operator<<(ostream &stream, BOP_Face *f)
|
||||
|
||||
return stream;
|
||||
}
|
||||
#endif
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "MT_Plane3.h"
|
||||
#include "BOP_Indexs.h"
|
||||
#include "BOP_BBox.h"
|
||||
#include "BOP_Misc.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
@ -80,7 +81,9 @@ public:
|
||||
virtual void replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex) = 0;
|
||||
virtual bool containsVertex(BOP_Index v) = 0;
|
||||
|
||||
#ifdef BOP_DEBUG
|
||||
friend ostream &operator<<(ostream &stream, BOP_Face *f);
|
||||
#endif
|
||||
};
|
||||
|
||||
class BOP_Face3: public BOP_Face
|
||||
|
@ -794,7 +794,8 @@ bool BOP_Mesh::isClosedMesh()
|
||||
}
|
||||
|
||||
|
||||
/** ***************************************************************************
|
||||
#ifdef BOP_DEBUG
|
||||
/******************************************************************************
|
||||
* DEBUG METHODS *
|
||||
* This functions are used to test the mesh state and debug program errors. *
|
||||
******************************************************************************/
|
||||
@ -1075,3 +1076,4 @@ void BOP_Mesh::updatePlanes()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,10 +1,3 @@
|
||||
/*
|
||||
* TEMPORARY defines to enable hashing support
|
||||
*/
|
||||
|
||||
#define HASH(x) ((x) >> 5) /* each "hash" covers 32 indices */
|
||||
// #define HASH_PRINTF_DEBUG /* uncomment to enable debug output */
|
||||
|
||||
/**
|
||||
*
|
||||
* $Id$
|
||||
|
43
intern/boolop/intern/BOP_Misc.h
Normal file
43
intern/boolop/intern/BOP_Misc.h
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
*
|
||||
* $Id: BOP_Misc.h 14444 2008-04-16 22:40:48Z khughes $
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): Ken Hughes
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains various definitions used across the modules
|
||||
*/
|
||||
|
||||
/*
|
||||
* define operator>> for faces, edges and vertices, and also add some
|
||||
* debugging functions for displaying various internal data structures
|
||||
*/
|
||||
|
||||
// #define BOP_DEBUG
|
||||
|
||||
#define HASH(x) ((x) >> 5) /* each "hash" covers 32 indices */
|
||||
// #define HASH_PRINTF_DEBUG /* uncomment to enable debug output */
|
@ -89,3 +89,22 @@ bool BOP_Vertex::containsEdge(BOP_Index i)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef BOP_DEBUG
|
||||
/**
|
||||
* Implements operator <<.
|
||||
*/
|
||||
#include <iomanip>
|
||||
|
||||
ostream &operator<<(ostream &stream, BOP_Vertex *v)
|
||||
{
|
||||
char aux[20];
|
||||
BOP_stringTAG(v->m_tag,aux);
|
||||
MT_Point3 point = v->getPoint();
|
||||
stream << setprecision(6) << showpoint << fixed;
|
||||
stream << "Vertex[" << point[0] << "," << point[1] << ",";
|
||||
stream << point[2] << "] (" << aux << ")";
|
||||
return stream;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "BOP_Tag.h"
|
||||
#include "BOP_Indexs.h"
|
||||
#include "MT_Point3.h"
|
||||
#include "BOP_Misc.h"
|
||||
|
||||
class BOP_Vertex
|
||||
{
|
||||
@ -52,6 +53,10 @@ public:
|
||||
inline MT_Point3 getPoint() const { return m_point;};
|
||||
inline BOP_TAG getTAG() { return m_tag;};
|
||||
inline void setTAG(BOP_TAG t) { m_tag = t;};
|
||||
#ifdef BOP_DEBUG
|
||||
friend ostream &operator<<(ostream &stream, BOP_Vertex *v);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user