Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-12-22 22:25:01 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-12-22 22:25:01 +0400
commitfa0211df269a3398dd70467982f9e129c79e501b (patch)
tree404ee267890602b49470cb640986b50d2c2055c1 /source/blender/freestyle/intern/geometry/GeomCleaner.h
parent8b57a67f3eb57366c2b3abcb8f3b04403d339e1a (diff)
Another "insanely" big code clean-up patch by Bastien Montagne, many thanks!
Diffstat (limited to 'source/blender/freestyle/intern/geometry/GeomCleaner.h')
-rw-r--r--source/blender/freestyle/intern/geometry/GeomCleaner.h408
1 files changed, 208 insertions, 200 deletions
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.h b/source/blender/freestyle/intern/geometry/GeomCleaner.h
index 5fdfda0162a..334145f3bcd 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.h
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.h
@@ -1,219 +1,227 @@
-//
-// Filename : GeomCleaner.h
-// Author : Stephane Grabli
-// Purpose : Class to define a cleaner of geometry providing
-// a set of useful tools
-// Date of creation : 04/03/2002
-//
-///////////////////////////////////////////////////////////////////////////////
-
-
-//
-// Copyright (C) : Please refer to the COPYRIGHT file distributed
-// with this source distribution.
-//
-// 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.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#ifndef GEOMCLEANER_H
-# define GEOMCLEANER_H
-
-# include "../system/FreestyleConfig.h"
-# include "Geom.h"
+/*
+ * ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2010 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __GEOMCLEANER_H__
+#define __GEOMCLEANER_H__
+
+/** \file blender/freestyle/intern/geometry/GeomCleaner.h
+ * \ingroup freestyle
+ * \brief Class to define a cleaner of geometry providing a set of useful tools
+ * \author Stephane Grabli
+ * \date 04/03/2002
+ */
+
+#include "Geom.h"
+
+#include "../system/FreestyleConfig.h"
using namespace Geometry;
class LIB_GEOMETRY_EXPORT GeomCleaner
{
public:
-
- inline GeomCleaner() {}
- inline ~GeomCleaner() {}
-
- /*! Sorts an array of Indexed vertices
- * iVertices
- * Array of vertices to sort. It is organized as a
- * float series of vertex coordinates: XYZXYZXYZ...
- * iVSize
- * The size of iVertices array.
- * iIndices
- * The array containing the vertex indices (used to refer
- * to the vertex coordinates in an indexed face). Each
- * element is an unsignedeger multiple of 3.
- * iISize
- * The size of iIndices array
- * oVertices
- * Output of sorted vertices. A vertex v1 precedes another one
- * v2 in this array if v1.x<v2.x, or v1.x=v2.x && v1.y < v2.y
- * or v1.x=v2.y && v1.y=v2.y && v1.z < v2.z.
- * The array is organized as a 3-float serie giving
- * the vertices coordinates: XYZXYZXYZ...
- * oIndices
- * Output corresponding to the iIndices array but
- * reorganized in order to match the sorted vertex array.
- */
-
- static void SortIndexedVertexArray(const float *iVertices, unsigned iVSize,
- const unsigned *iIndices, unsigned iISize,
- real **oVertices,
- unsigned **oIndices);
-
- /*! Compress a SORTED indexed vertex array by eliminating
- * multiple appearing occurences of a single vertex.
- * iVertices
- * The SORTED vertex array to compress. It is organized as a
- * float series of vertex coordinates: XYZXYZXYZ...
- * iVSize
- * The size of iVertices array.
- * iIndices
- * The array containing the vertex indices (used to refer
- * to the vertex coordinates in an indexed face). Each
- * element is an unsignedeger multiple of 3.
- * iISize
- * The size of iIndices array
- * oVertices
- * The vertex array, result of the compression.
- * The array is organized as a 3-float serie giving
- * the vertices coordinates: XYZXYZXYZ...
- * oVSize
- * The size of oVertices.
- * oIndices
- * The indices array, reorganized to match the compressed
- * oVertices array.
- */
-
- static void CompressIndexedVertexArray(const real *iVertices, unsigned iVSize,
- const unsigned *iIndices, unsigned iISize,
- real **oVertices, unsigned *oVSize,
- unsigned **oIndices);
-
- /*! Sorts and compress an array of indexed vertices.
- * iVertices
- * The vertex array to sort then compress. It is organized as a
- * float series of vertex coordinates: XYZXYZXYZ...
- * iVSize
- * The size of iVertices array.
- * iIndices
- * The array containing the vertex indices (used to refer
- * to the vertex coordinates in an indexed face). Each
- * element is an unsignedeger multiple of 3.
- * iISize
- * The size of iIndices array
- * oVertices
- * The vertex array, result of the sorting-compression.
- * The array is organized as a 3-float serie giving
- * the vertices coordinates: XYZXYZXYZ...
- * oVSize
- * The size of oVertices.
- * oIndices
- * The indices array, reorganized to match the sorted and compressed
- * oVertices array.
- */
-
- static void SortAndCompressIndexedVertexArray(const float *iVertices, unsigned iVSize,
- const unsigned *iIndices, unsigned iISize,
- real **oVertices, unsigned *oVSize,
- unsigned **oIndices);
-
- /*! Cleans an indexed vertex array. (Identical to
- * SortAndCompress except that we use here a hash
- * table to create the new array.)
- * iVertices
- * The vertex array to sort then compress. It is organized as a
- * float series of vertex coordinates: XYZXYZXYZ...
- * iVSize
- * The size of iVertices array.
- * iIndices
- * The array containing the vertex indices (used to refer
- * to the vertex coordinates in an indexed face). Each
- * element is an unsignedeger multiple of 3.
- * iISize
- * The size of iIndices array
- * oVertices
- * The vertex array, result of the sorting-compression.
- * The array is organized as a 3-float serie giving
- * the vertices coordinates: XYZXYZXYZ...
- * oVSize
- * The size of oVertices.
- * oIndices
- * The indices array, reorganized to match the sorted and compressed
- * oVertices array.
- */
-
- static void CleanIndexedVertexArray(const float *iVertices, unsigned iVSize,
- const unsigned *iIndices, unsigned iISize,
- real **oVertices, unsigned *oVSize,
- unsigned **oIndices);
+ inline GeomCleaner() {}
+ inline ~GeomCleaner() {}
+
+ /*! Sorts an array of Indexed vertices
+ * iVertices
+ * Array of vertices to sort. It is organized as a float series of vertex coordinates: XYZXYZXYZ...
+ * iVSize
+ * The size of iVertices array.
+ * iIndices
+ * The array containing the vertex indices (used to refer to the vertex coordinates in an indexed face). Each
+ * element is an unsignedeger multiple of 3.
+ * iISize
+ * The size of iIndices array
+ * oVertices
+ * Output of sorted vertices. A vertex v1 precedes another one v2 in this array if v1.x<v2.x,
+ * or v1.x=v2.x && v1.y < v2.y or v1.x=v2.y && v1.y=v2.y && v1.z < v2.z.
+ * The array is organized as a 3-float serie giving the vertices coordinates: XYZXYZXYZ...
+ * oIndices
+ * Output corresponding to the iIndices array but reorganized in order to match the sorted vertex array.
+ */
+ static void SortIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
+ unsigned iISize, real **oVertices, unsigned **oIndices);
+
+ /*! Compress a SORTED indexed vertex array by eliminating multiple appearing occurences of a single vertex.
+ * iVertices
+ * The SORTED vertex array to compress. It is organized as a float series of vertex coordinates: XYZXYZXYZ...
+ * iVSize
+ * The size of iVertices array.
+ * iIndices
+ * The array containing the vertex indices (used to refer to the vertex coordinates in an indexed face).
+ * Each element is an unsignedeger multiple of 3.
+ * iISize
+ * The size of iIndices array
+ * oVertices
+ * The vertex array, result of the compression.
+ * The array is organized as a 3-float serie giving the vertices coordinates: XYZXYZXYZ...
+ * oVSize
+ * The size of oVertices.
+ * oIndices
+ * The indices array, reorganized to match the compressed oVertices array.
+ */
+ static void CompressIndexedVertexArray(const real *iVertices, unsigned iVSize, const unsigned *iIndices,
+ unsigned iISize, real **oVertices, unsigned *oVSize, unsigned **oIndices);
+
+ /*! Sorts and compress an array of indexed vertices.
+ * iVertices
+ * The vertex array to sort then compress. It is organized as a float series of
+ * vertex coordinates: XYZXYZXYZ...
+ * iVSize
+ * The size of iVertices array.
+ * iIndices
+ * The array containing the vertex indices (used to refer to the vertex coordinates in an indexed face).
+ * Each element is an unsignedeger multiple of 3.
+ * iISize
+ * The size of iIndices array
+ * oVertices
+ * The vertex array, result of the sorting-compression.
+ * The array is organized as a 3-float serie giving the vertices coordinates: XYZXYZXYZ...
+ * oVSize
+ * The size of oVertices.
+ * oIndices
+ * The indices array, reorganized to match the sorted and compressed oVertices array.
+ */
+ static void SortAndCompressIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
+ unsigned iISize, real **oVertices, unsigned *oVSize,
+ unsigned **oIndices);
+
+ /*! Cleans an indexed vertex array. (Identical to SortAndCompress except that we use here a hash table
+ * to create the new array.)
+ * iVertices
+ * The vertex array to sort then compress. It is organized as a float series of
+ * vertex coordinates: XYZXYZXYZ...
+ * iVSize
+ * The size of iVertices array.
+ * iIndices
+ * The array containing the vertex indices (used to refer to the vertex coordinates in an indexed face).
+ * Each element is an unsignedeger multiple of 3.
+ * iISize
+ * The size of iIndices array
+ * oVertices
+ * The vertex array, result of the sorting-compression.
+ * The array is organized as a 3-float serie giving the vertices coordinates: XYZXYZXYZ...
+ * oVSize
+ * The size of oVertices.
+ * oIndices
+ * The indices array, reorganized to match the sorted and compressed oVertices array.
+ */
+ static void CleanIndexedVertexArray(const float *iVertices, unsigned iVSize, const unsigned *iIndices,
+ unsigned iISize, real **oVertices, unsigned *oVSize, unsigned **oIndices);
};
/*! Binary operators */
//inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
-/*! Class Indexed Vertex. Used to represent
- * an indexed vertex by storing the vertex
- * coordinates as well as its index
- */
+/*! Class Indexed Vertex. Used to represent an indexed vertex by storing the vertex coordinates as well as its index */
class IndexedVertex
{
-public:
-
private:
- Vec3r _Vector;
- unsigned _index;
+ Vec3r _Vector;
+ unsigned _index;
+
public:
- inline IndexedVertex() {}
- inline IndexedVertex(Vec3r iVector, unsigned iIndex)
- {
- _Vector = iVector;
- _index = iIndex;
- }
- /*! accessors */
- inline const Vec3r& vector() const {return _Vector;}
- inline unsigned index() {return _index;}
- inline real x() {return _Vector[0];}
- inline real y() {return _Vector[1];}
- inline real z() {return _Vector[2];}
-
- /*! modifiers */
- inline void setVector(const Vec3r& iVector) {_Vector = iVector;}
- inline void setIndex(unsigned iIndex) {_index = iIndex;}
-
- /*! operators */
- IndexedVertex& operator=(const IndexedVertex& iv)
- {
- _Vector = iv._Vector;
- _index = iv._index;
- return *this;
- }
- inline real operator[](const unsigned i) {return _Vector[i];}
- //friend inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
- inline bool operator<(const IndexedVertex& v) const
- {
- return (_Vector < v._Vector);
- }
- inline bool operator==(const IndexedVertex& v)
- {
- return (_Vector == v._Vector);
- }
+ inline IndexedVertex() {}
+
+ inline IndexedVertex(Vec3r iVector, unsigned iIndex)
+ {
+ _Vector = iVector;
+ _index = iIndex;
+ }
+
+ /*! accessors */
+ inline const Vec3r& vector() const
+ {
+ return _Vector;
+ }
+
+ inline unsigned index()
+ {
+ return _index;
+ }
+
+ inline real x()
+ {
+ return _Vector[0];
+ }
+
+ inline real y()
+ {
+ return _Vector[1];
+ }
+
+ inline real z()
+ {
+ return _Vector[2];
+ }
+
+ /*! modifiers */
+ inline void setVector(const Vec3r& iVector)
+ {
+ _Vector = iVector;
+ }
+
+ inline void setIndex(unsigned iIndex)
+ {
+ _index = iIndex;
+ }
+
+ /*! operators */
+ IndexedVertex& operator=(const IndexedVertex& iv)
+ {
+ _Vector = iv._Vector;
+ _index = iv._index;
+ return *this;
+ }
+
+ inline real operator[](const unsigned i)
+ {
+ return _Vector[i];
+ }
+
+ //friend inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
+ inline bool operator<(const IndexedVertex& v) const
+ {
+ return (_Vector < v._Vector);
+ }
+
+ inline bool operator==(const IndexedVertex& v)
+ {
+ return (_Vector == v._Vector);
+ }
};
-//bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2)
-//{
-// return iv1.operator<(iv2);
-//}
+#if 0
+bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2)
+{
+ return iv1.operator<(iv2);
+}
+#endif
-#endif // GEOMCLEANER_H
+#endif // __GEOMCLEANER_H__