fix const correctnes of face/component.h

This commit is contained in:
alemuntoni 2021-03-24 19:15:10 +01:00
parent d69e3e67cc
commit adb799a0a2
5 changed files with 41 additions and 25 deletions

View File

@ -235,19 +235,19 @@ public:
ScalarT cotB = 0;
// Get the edge (a pair of vertices)
VertexType * v0 = f.cV(edge);
VertexType * v1 = f.cV((edge+1)%f.VN());
const VertexType * v0 = f.cV(edge);
const VertexType * v1 = f.cV((edge+1)%f.VN());
if (fp != NULL &&
fp != &f)
{
// not a border edge
VertexType * vb = fp->cV((f.cFFi(edge)+2)%fp->VN());
const VertexType * vb = fp->cV((f.cFFi(edge)+2)%fp->VN());
ScalarT angleB = ComputeAngle<ScalarT>(v0, vb, v1);
cotB = vcg::math::Cos(angleB) / vcg::math::Sin(angleB);
}
VertexType * va = f.cV((edge+2)%f.VN());
const VertexType * va = f.cV((edge+2)%f.VN());
ScalarT angleA = ComputeAngle<ScalarT>(v0, va, v1);
cotA = vcg::math::Cos(angleA) / vcg::math::Sin(angleA);

View File

@ -813,7 +813,7 @@ private:
{
if (faces[i]->IsFaceEdgeS(VtoE(vIdxes[i], (vIdxes[i]+1)%3)) && !vcg::tri::IsMarked(*params.m, faces[i]->cV1(vIdxes[i])))
{
vcg::tri::Mark(*params.m,faces[i]->cV1(vIdxes[i]));
vcg::tri::Mark(*params.m,faces[i]->V1(vIdxes[i]));
incidentFeatures++;
CoordType movingEdgeVector0 = (faces[i]->cP1(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
if (std::fabs(movingEdgeVector0 * dEdgeVector) < .9f || !p.IsEdgeS())
@ -821,7 +821,7 @@ private:
}
if (faces[i]->IsFaceEdgeS(VtoE(vIdxes[i], (vIdxes[i]+2)%3)) && !vcg::tri::IsMarked(*params.m, faces[i]->cV2(vIdxes[i])))
{
vcg::tri::Mark(*params.m,faces[i]->cV2(vIdxes[i]));
vcg::tri::Mark(*params.m,faces[i]->V2(vIdxes[i]));
incidentFeatures++;
CoordType movingEdgeVector1 = (faces[i]->cP2(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
if (std::fabs(movingEdgeVector1 * dEdgeVector) < .9f || !p.IsEdgeS())

View File

@ -40,15 +40,15 @@ namespace face {
template <class T> class EmptyCore: public T {
public:
inline typename T::VertexType * &V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * V( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * cV( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * &FVp( const int i ) { return this->V(i); }
inline typename T::VertexType * FVp( const int i ) const { return this->cV(i); }
inline typename T::VertexType * cFVp( const int i ) const { return this->cV(i); }
inline typename T::CoordType &P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::CoordType P( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::CoordType cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::VertexType * &V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
inline const typename T::VertexType * V( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline const typename T::VertexType * cV( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * &FVp( const int i ) { return this->V(i); }
inline const typename T::VertexType * FVp( const int i ) const { return this->cV(i); }
inline const typename T::VertexType * cFVp( const int i ) const { return this->cV(i); }
inline typename T::CoordType &P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::CoordType P( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::CoordType cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
static bool HasVertexRef() { return false; }
static bool HasFVAdjacency() { return false; }
@ -200,7 +200,7 @@ public:
inline typename T::VertexType * &V( const int j ) { assert(j>=0 && j<3); return v[j]; } /// \brief The pointer to the i-th vertex
inline const typename T::VertexType * V (const int j) const { assert(j>=0 && j<3); return v[j]; }
inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
inline const typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
inline CoordType &P( const int j ) { assert(j>=0 && j<3); return v[j]->P(); } /// \brief Shortcut: the position of the i-th vertex (equivalent to \c V(i)->P() )
inline const CoordType &P( const int j ) const { assert(j>=0 && j<3); return v[j]->P(); }
@ -212,9 +212,9 @@ public:
inline const typename T::VertexType * V0( const int j ) const { return V(j);} /** \brief Return the pointer to the j-th vertex of the face. */
inline const typename T::VertexType * V1( const int j ) const { return V((j+1)%3);} /** \brief Return the pointer to the ((j+1)%3)-th vertex of the face. */
inline const typename T::VertexType * V2( const int j ) const { return V((j+2)%3);} /** \brief Return the pointer to the ((j+2)%3)-th vertex of the face. */
inline typename T::VertexType * cV0( const int j ) const { return cV(j);}
inline typename T::VertexType * cV1( const int j ) const { return cV((j+1)%3);}
inline typename T::VertexType * cV2( const int j ) const { return cV((j+2)%3);}
inline const typename T::VertexType * cV0( const int j ) const { return cV(j);}
inline const typename T::VertexType * cV1( const int j ) const { return cV((j+1)%3);}
inline const typename T::VertexType * cV2( const int j ) const { return cV((j+2)%3);}
inline CoordType & P0( const int j ) { return V(j)->P();}
inline CoordType & P1( const int j ) { return V((j+1)%3)->P();}

View File

@ -219,15 +219,22 @@ public:
}
/// return the vertex that it should have if we make FlipV;
VertexType *VFlip() const
VertexType *VFlip()
{
assert(f->cV(f->Prev(z))!=v && (f->cV(f->Next(z))==v || f->cV(z)==v));
if(f->cV(f->Next(z))==v) return f->cV(z);
else return f->cV(f->Next(z));
assert(f->V(f->Prev(z))!=v && (f->V(f->Next(z))==v || f->V(z)==v));
if(f->V(f->Next(z))==v) return f->V(z);
else return f->V(f->Next(z));
}
const VertexType *VFlip() const
{
assert(f->V(f->Prev(z))!=v && (f->V(f->Next(z))==v || f->V(z)==v));
if(f->V(f->Next(z))==v) return f->V(z);
else return f->V(f->Next(z));
}
/// return the face that it should have if we make FlipF;
FaceType *FFlip() const
FaceType *FFlip()
{
// assert( f->FFp(z)->FFp(f->FFi(z))==f );
// assert(f->V(f->Prev(z))!=v);
@ -236,6 +243,15 @@ public:
return nf;
}
const FaceType *FFlip() const
{
// assert( f->FFp(z)->FFp(f->FFi(z))==f );
// assert(f->V(f->Prev(z))!=v);
// assert(f->V(f->Next(z))==v || f->V((z+0)%f->VN())==v);
const FaceType *nf=f->FFp(z);
return nf;
}
// Trova il prossimo half-edge di bordo (nhe)
// tale che

View File

@ -448,7 +448,7 @@ namespace io {
/*
returns index of the vertex
*/
inline static int GetIndexVertex(const SaveMeshType &m, VertexType *p)
inline static int GetIndexVertex(const SaveMeshType &m, const VertexType *p)
{
return p-&*(m.vert.begin());
}