changed access to face functions (border, area)
removed some typecast warnings
This commit is contained in:
parent
a5d8bd82ac
commit
f5d1b6c337
|
@ -24,6 +24,10 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.8 2005/10/11 16:03:40 rita_borgo
|
||||
Added new functions belonging to triMeshInfo
|
||||
Started the Self-Intersection routine
|
||||
|
||||
Revision 1.7 2005/10/03 15:57:53 rita_borgo
|
||||
Alligned with TriMeshInfo Code
|
||||
|
||||
|
@ -55,6 +59,7 @@ Initial Release
|
|||
#include <algorithm>
|
||||
|
||||
#include <vcg/simplex/face/face.h>
|
||||
#include<vcg/simplex/face/topology.h>
|
||||
#include <vcg/complex/trimesh/base.h>
|
||||
#include <vcg/complex/trimesh/closest.h>
|
||||
#include <vcg/space/index/grid_static_ptr.h>
|
||||
|
@ -93,12 +98,11 @@ namespace vcg {
|
|||
vcg::face::Pos<FaceType> hei;
|
||||
|
||||
/* classe di confronto per l'algoritmo di eliminazione vertici duplicati*/
|
||||
template <class VertexIterator>
|
||||
class RemoveDuplicateVert_Compare{
|
||||
public:
|
||||
inline bool operator() (VertexIterator a, VertexIterator b)
|
||||
inline bool operator()(VertexPointer &a, VertexPointer &b)
|
||||
{
|
||||
return *a < *b;
|
||||
return (*a).cP() < (*b).cP();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -147,12 +151,12 @@ namespace vcg {
|
|||
VertexIterator vi;
|
||||
int deleted=0;
|
||||
int k=0;
|
||||
int num_vert = m.vert.size();
|
||||
size_t num_vert = m.vert.size();
|
||||
std::vector<VertexPointer> perm(num_vert);
|
||||
for(vi=m.vert.begin(); vi!=m.vert.end(); ++vi, ++k)
|
||||
perm[k] = &(*vi);
|
||||
|
||||
RemoveDuplicateVert_Compare<VertexPointer> c_obj;
|
||||
RemoveDuplicateVert_Compare c_obj;
|
||||
|
||||
std::sort(perm.begin(),perm.end(),c_obj);
|
||||
|
||||
|
@ -262,7 +266,7 @@ namespace vcg {
|
|||
count_e +=3; //assume that we have to increase the number of edges with three
|
||||
for(int j=0; j<3; j++)
|
||||
{
|
||||
if (fi->IsBorder(j)) //If this edge is a border edge
|
||||
if (face::IsBorder(*fi,j)) //If this edge is a border edge
|
||||
boundary_e++; // then increase the number of boundary edges
|
||||
else if (IsManifold(*fi,j))//If this edge is manifold
|
||||
{
|
||||
|
@ -321,7 +325,7 @@ namespace vcg {
|
|||
{
|
||||
if(fi->V(j)->IsS()) continue;
|
||||
|
||||
if((*fi).IsBorder(j))//found an unvisited border edge
|
||||
if(face::IsBorder(*fi,j))//found an unvisited border edge
|
||||
{
|
||||
he.Set(&(*fi),j,fi->V(j)); //set the face-face iterator to the current face, edge and vertex
|
||||
vector<Point3x> hole; //start of a new hole
|
||||
|
@ -339,7 +343,7 @@ namespace vcg {
|
|||
//cut and paste the additional hole.
|
||||
vector<Point3x> hole2;
|
||||
int index = find(hole.begin(),hole.end(),newpoint) - hole.begin();
|
||||
for(int i=index; i<hole.size(); i++)
|
||||
for(unsigned int i=index; i<hole.size(); i++)
|
||||
hole2.push_back(hole[i]);
|
||||
|
||||
hole.resize(index);
|
||||
|
@ -401,7 +405,7 @@ namespace vcg {
|
|||
sf.pop();
|
||||
for(int j=0;j<3;++j)
|
||||
{
|
||||
if( !(*gi).IsBorder(j) )
|
||||
if( !face::IsBorder(*gi,j) )
|
||||
{
|
||||
l=he.f->FFp(j);
|
||||
if( !(*l).IsS() )
|
||||
|
@ -425,16 +429,41 @@ namespace vcg {
|
|||
|
||||
|
||||
for(fi=m.face.begin(); fi!=m.face.end();++fi)
|
||||
if((*fi).Area() == 0)
|
||||
if(Area<FaceType>(*fi) == 0)
|
||||
count_fd++;
|
||||
return count_fd;
|
||||
}
|
||||
/**
|
||||
GENUS: A topologically invariant property of a surface defined as:
|
||||
the largest number of nonintersecting simple closed curves that can be drawn on the surface without separating it.
|
||||
Roughly speaking, it is the number of holes in a surface.
|
||||
The genus g of a surface, also called the geometric genus, is related to the Euler characteristic $chi$ by $chi==2-2g$.
|
||||
|
||||
The genus of a connected, orientable surface is an integer representing the maximum number of cuttings along closed
|
||||
simple curves without rendering the resultant manifold disconnected. It is equal to the number of handles on it.
|
||||
|
||||
static float MeshGenus(MeshType &m, int count_uv, int numholes, int numcomponents, int count_e)
|
||||
*/
|
||||
static int MeshGenus(MeshType &m, int count_uv, int numholes, int numcomponents, int count_e)
|
||||
{
|
||||
int eulernumber = (m.vn-count_uv) + m.fn - count_e;
|
||||
return(-( 0.5 * (eulernumber - numholes) - numcomponents ));
|
||||
}
|
||||
/*
|
||||
Let a closed surface have genus g. Then the polyhedral formula generalizes to the Poincaré formula
|
||||
chi=V-E+F, (1)
|
||||
|
||||
where
|
||||
chi(g)==2-2g (2)
|
||||
|
||||
is the Euler characteristic, sometimes also known as the Euler-Poincaré characteristic.
|
||||
The polyhedral formula corresponds to the special case g==0.
|
||||
*/
|
||||
|
||||
static int EulerCharacteristic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void IsRegularMesh(MeshType &m, bool Regular, bool Semiregular)
|
||||
{
|
||||
|
@ -450,7 +479,7 @@ namespace vcg {
|
|||
for (int j=0; j<3; j++)
|
||||
{
|
||||
he.Set(&(*fi),j,fi->V(j));
|
||||
if (!(*fi).IsBorder(j) && !(*fi).IsBorder((j+2)%3) && !fi->V(j)->IsS())
|
||||
if (!face::IsBorder(*fi,j) && !face::IsBorder(*fi,(j+2)%3) && !fi->V(j)->IsS())
|
||||
{
|
||||
hei=he;
|
||||
inc=1;
|
||||
|
@ -512,7 +541,7 @@ namespace vcg {
|
|||
sf.pop();
|
||||
for(int j=0;j<3;++j)
|
||||
{
|
||||
if( !(*gi).IsBorder(j) )
|
||||
if( !face::IsBorder(*gi,j) )
|
||||
{
|
||||
he.Set(&(*gi),0,gi->V(0));
|
||||
l=he.f->FFp(j);
|
||||
|
|
Loading…
Reference in New Issue