mirror of
https://github.com/lgfischer/dcel.git
synced 2026-11-16 00:07:05 -03:00
Some warnings corrected, most are conversions between int's and unsigned int's. Thanks to @jimmyskull
This commit is contained in:
1 parent
907922fdee
commit
3eac5bfa85
3 files changed
+16
-16
No files matched your search
@@ -41,11 +41,9 @@ public:
|
||||
template<class MeshT, class MeshT2>
|
||||
static void copyDcelData(const MeshT& source, MeshT2& target )
|
||||
{
|
||||
const MeshT::Vertex* vertex = NULL;
|
||||
const unsigned int numVertices = source.getNumVertices();
|
||||
const MeshT::Face* face = NULL;
|
||||
const unsigned int numVertices = source.getNumVertices();
|
||||
const unsigned int numFaces = source.getNumFaces();
|
||||
const MeshT::HalfEdge* edge = NULL;
|
||||
const unsigned int numEdges = source.getNumHalfEdges();
|
||||
|
||||
target.clear();
|
||||
@@ -134,10 +132,9 @@ template <class MeshT>
|
||||
void DCELStream<MeshT>::write(const MeshT& mesh, std::ostream &stream)
|
||||
{
|
||||
const MeshT::Vertex* vertex = NULL;
|
||||
const unsigned int numVertices = mesh.getNumVertices();
|
||||
const MeshT::Face* face = NULL;
|
||||
const unsigned int numVertices = mesh.getNumVertices();
|
||||
const unsigned int numFaces = mesh.getNumFaces();
|
||||
const MeshT::HalfEdge* edge = NULL;
|
||||
const unsigned int numEdges = mesh.getNumHalfEdges();
|
||||
|
||||
stream << "version 1" << std::endl;
|
||||
@@ -229,19 +226,19 @@ void DCELStream<MeshT>::read_v1(MeshT& mesh, std::istream &stream)
|
||||
|
||||
else if( str=="vc" )
|
||||
{
|
||||
unsigned int vc = -1;
|
||||
unsigned int vc = std::numeric_limits<unsigned int>::max();
|
||||
stream >> vc;
|
||||
mesh.getVertices().reserve( vc*5 );
|
||||
}
|
||||
else if( str=="fc" )
|
||||
{
|
||||
unsigned int fc = -1;
|
||||
unsigned int fc = std::numeric_limits<unsigned int>::max();
|
||||
stream >> fc;
|
||||
mesh.getFaces().reserve( fc*5 );
|
||||
}
|
||||
else if( str=="ec" )
|
||||
{
|
||||
unsigned int ec = -1;
|
||||
unsigned int ec = std::numeric_limits<unsigned int>::max();
|
||||
stream >> ec;
|
||||
mesh.getHalfEdges().reserve( ec*5 );
|
||||
}
|
||||
|
||||
+10
-7
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <limits>
|
||||
|
||||
#include "Vertex.h"
|
||||
#include "Face.h"
|
||||
@@ -20,6 +21,8 @@
|
||||
|
||||
#include "Exception.h"
|
||||
|
||||
#define MESH_NULL_ID (std::numeric_limits<unsigned int>::max())
|
||||
|
||||
/**
|
||||
A class that stores the mesh structure. It the list of the vertices, edges and faces.
|
||||
Also, it has some methods for simplify the mesh manipulation.
|
||||
@@ -250,7 +253,7 @@ private:
|
||||
std::vector<HalfEdge> edges;
|
||||
|
||||
std::list<int> unhandledTriangles;
|
||||
int unhandledTrianglesCount;
|
||||
unsigned int unhandledTrianglesCount;
|
||||
};
|
||||
|
||||
|
||||
@@ -334,7 +337,7 @@ unsigned int Mesh<Vdt,Hdt,Fdt>::createTriangularFace(unsigned int vId1, unsigned
|
||||
if (e2!=NULL) readyEdges++;
|
||||
if (e3!=NULL) readyEdges++;
|
||||
|
||||
unsigned int nullFaceId = (unsigned int)-1;
|
||||
unsigned int nullFaceId = MESH_NULL_ID;
|
||||
unsigned int faceId = nullFaceId;
|
||||
Face* face = NULL;
|
||||
|
||||
@@ -734,7 +737,7 @@ unsigned int Mesh<Vdt,Hdt,Fdt>::getVertexId(const Vertex* vertex) const
|
||||
if( &(this->vertices[id]) == vertex )
|
||||
return id;
|
||||
}
|
||||
return -1;
|
||||
return MESH_NULL_ID;
|
||||
}
|
||||
|
||||
template<class Vdt, class Hdt, class Fdt>
|
||||
@@ -772,7 +775,7 @@ unsigned int Mesh<Vdt,Hdt,Fdt>::getFaceId(const Face* face) const
|
||||
if( &(this->faces[id]) == face )
|
||||
return id;
|
||||
}
|
||||
return -1;
|
||||
return MESH_NULL_ID;
|
||||
};
|
||||
|
||||
template<class Vdt, class Hdt, class Fdt>
|
||||
@@ -832,7 +835,7 @@ unsigned int Mesh<Vdt,Hdt,Fdt>::getHalfEdgeId( HalfEdge* halfEdge) const
|
||||
if( &(this->edges[id]) == halfEdge )
|
||||
return id;
|
||||
}
|
||||
return -1;
|
||||
return MESH_NULL_ID;
|
||||
}
|
||||
|
||||
template<class Vdt, class Hdt, class Fdt>
|
||||
@@ -960,12 +963,12 @@ void Mesh<Vdt,Hdt,Fdt>::manageUnhandledTriangles()
|
||||
throw cpp::Exception("The number of unhandled triangles should be equal to the number of unhandled vertices*3!");
|
||||
}
|
||||
|
||||
int curTriangle = 0;
|
||||
unsigned int curTriangle = 0;
|
||||
while( !this->unhandledTriangles.empty() )
|
||||
{
|
||||
if( curTriangle==unhandledTrianglesCount )
|
||||
{
|
||||
int remainingTriangles = this->unhandledTriangles.size() / 3;
|
||||
unsigned int remainingTriangles = this->unhandledTriangles.size() / 3;
|
||||
if( remainingTriangles<unhandledTrianglesCount )
|
||||
{
|
||||
unhandledTrianglesCount = remainingTriangles;
|
||||
|
||||
Reference in new issue
Block a user