changed to the new RequireXXXX syntax for type reflections
This commit is contained in:
parent
c5d8479003
commit
63e5ef9763
|
@ -90,9 +90,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static void PrincipalDirections(MeshType &m)
|
static void PrincipalDirections(MeshType &m)
|
||||||
{
|
{
|
||||||
|
tri::RequireVFAdjacency(m);
|
||||||
assert(tri::HasPerFaceVFAdjacency(m) && tri::HasPerVertexVFAdjacency(m));
|
|
||||||
|
|
||||||
vcg::tri::UpdateNormal<MeshType>::PerVertexAngleWeighted(m);
|
vcg::tri::UpdateNormal<MeshType>::PerVertexAngleWeighted(m);
|
||||||
vcg::tri::UpdateNormal<MeshType>::NormalizePerVertex(m);
|
vcg::tri::UpdateNormal<MeshType>::NormalizePerVertex(m);
|
||||||
|
|
||||||
|
@ -400,7 +398,8 @@ For further details, please, refer to: \n
|
||||||
*/
|
*/
|
||||||
static void MeanAndGaussian(MeshType & m)
|
static void MeanAndGaussian(MeshType & m)
|
||||||
{
|
{
|
||||||
assert(HasFFAdjacency(m));
|
tri::RequireFFAdjacency(m);
|
||||||
|
|
||||||
float area0, area1, area2, angle0, angle1, angle2;
|
float area0, area1, area2, angle0, angle1, angle2;
|
||||||
FaceIterator fi;
|
FaceIterator fi;
|
||||||
VertexIterator vi;
|
VertexIterator vi;
|
||||||
|
@ -591,9 +590,7 @@ static void MeanAndGaussian(MeshType & m)
|
||||||
|
|
||||||
static void PerVertex(MeshType & m)
|
static void PerVertex(MeshType & m)
|
||||||
{
|
{
|
||||||
// VFAdjacency required!
|
tri::RequireVFAdjacency(m);
|
||||||
assert(FaceType::HasVFAdjacency());
|
|
||||||
assert(VertexType::HasVFAdjacency());
|
|
||||||
|
|
||||||
for(VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
|
for(VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
|
||||||
ComputeSingleVertexCurvature(&*vi,false);
|
ComputeSingleVertexCurvature(&*vi,false);
|
||||||
|
@ -612,9 +609,9 @@ static void MeanAndGaussian(MeshType & m)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void PrincipalDirectionsNormalCycle(MeshType & m){
|
static void PrincipalDirectionsNormalCycle(MeshType & m){
|
||||||
assert(VertexType::HasVFAdjacency());
|
tri::RequireVFAdjacency(m);
|
||||||
assert(FaceType::HasFFAdjacency());
|
tri::RequireFFAdjacency(m);
|
||||||
assert(FaceType::HasFaceNormal());
|
tri::RequirePerFaceNormal(m);
|
||||||
|
|
||||||
typename MeshType::VertexIterator vi;
|
typename MeshType::VertexIterator vi;
|
||||||
|
|
||||||
|
@ -626,7 +623,6 @@ static void MeanAndGaussian(MeshType & m)
|
||||||
typename MeshType::VertexType * firstv = p.VFlip();
|
typename MeshType::VertexType * firstv = p.VFlip();
|
||||||
assert(p.F()->V(p.VInd())==&(*vi));
|
assert(p.F()->V(p.VInd())==&(*vi));
|
||||||
|
|
||||||
|
|
||||||
do{
|
do{
|
||||||
if( p.F() != p.FFlip()){
|
if( p.F() != p.FFlip()){
|
||||||
Point3<ScalarType> normalized_edge = p.F()->V(p.F()->Next(p.VInd()))->cP() - (*vi).P();
|
Point3<ScalarType> normalized_edge = p.F()->V(p.F()->Next(p.VInd()))->cP() - (*vi).P();
|
||||||
|
|
|
@ -43,7 +43,6 @@ class UpdateFlags
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef UpdateMeshType MeshType;
|
typedef UpdateMeshType MeshType;
|
||||||
typedef vcg::face::Pos<typename UpdateMeshType::FaceType> PosType;
|
|
||||||
typedef typename MeshType::ScalarType ScalarType;
|
typedef typename MeshType::ScalarType ScalarType;
|
||||||
typedef typename MeshType::VertexType VertexType;
|
typedef typename MeshType::VertexType VertexType;
|
||||||
typedef typename MeshType::VertexPointer VertexPointer;
|
typedef typename MeshType::VertexPointer VertexPointer;
|
||||||
|
@ -72,7 +71,7 @@ public:
|
||||||
|
|
||||||
static void VertexClear(MeshType &m, unsigned int FlagMask = 0xffffffff)
|
static void VertexClear(MeshType &m, unsigned int FlagMask = 0xffffffff)
|
||||||
{
|
{
|
||||||
if(!HasPerVertexFlags(m)) throw vcg::MissingComponentException("VertexFlags");
|
tri::RequirePerVertexFlags(m);
|
||||||
int andMask = ~FlagMask;
|
int andMask = ~FlagMask;
|
||||||
for(VertexIterator vi=m.vert.begin(); vi!=m.vert.end(); ++vi)
|
for(VertexIterator vi=m.vert.begin(); vi!=m.vert.end(); ++vi)
|
||||||
if(!(*vi).IsD()) (*vi).Flags() &= andMask ;
|
if(!(*vi).IsD()) (*vi).Flags() &= andMask ;
|
||||||
|
@ -80,7 +79,7 @@ public:
|
||||||
|
|
||||||
static void EdgeClear(MeshType &m, unsigned int FlagMask = 0xffffffff)
|
static void EdgeClear(MeshType &m, unsigned int FlagMask = 0xffffffff)
|
||||||
{
|
{
|
||||||
if(!HasPerEdgeFlags(m)) throw vcg::MissingComponentException("EdgeFlags");
|
tri::RequirePerEdgeFlags(m);
|
||||||
int andMask = ~FlagMask;
|
int andMask = ~FlagMask;
|
||||||
for(EdgeIterator ei=m.edge.begin(); ei!=m.edge.end(); ++ei)
|
for(EdgeIterator ei=m.edge.begin(); ei!=m.edge.end(); ++ei)
|
||||||
if(!(*ei).IsD()) (*ei).Flags() &= andMask ;
|
if(!(*ei).IsD()) (*ei).Flags() &= andMask ;
|
||||||
|
@ -88,7 +87,7 @@ public:
|
||||||
|
|
||||||
static void FaceClear(MeshType &m, unsigned int FlagMask = 0xffffffff)
|
static void FaceClear(MeshType &m, unsigned int FlagMask = 0xffffffff)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceFlags(m)) throw vcg::MissingComponentException("FaceFlags");
|
tri::RequirePerFaceFlags(m);
|
||||||
int andMask = ~FlagMask;
|
int andMask = ~FlagMask;
|
||||||
for(FaceIterator fi=m.face.begin(); fi!=m.face.end(); ++fi)
|
for(FaceIterator fi=m.face.begin(); fi!=m.face.end(); ++fi)
|
||||||
if(!(*fi).IsD()) (*fi).Flags() &= andMask ;
|
if(!(*fi).IsD()) (*fi).Flags() &= andMask ;
|
||||||
|
@ -96,14 +95,14 @@ public:
|
||||||
|
|
||||||
static void VertexSet(MeshType &m, unsigned int FlagMask)
|
static void VertexSet(MeshType &m, unsigned int FlagMask)
|
||||||
{
|
{
|
||||||
if(!HasPerVertexFlags(m)) throw vcg::MissingComponentException("VertexFlags");
|
tri::RequirePerVertexFlags(m);
|
||||||
for(VertexIterator vi=m.vert.begin(); vi!=m.vert.end(); ++vi)
|
for(VertexIterator vi=m.vert.begin(); vi!=m.vert.end(); ++vi)
|
||||||
if(!(*vi).IsD()) (*vi).Flags() |= FlagMask ;
|
if(!(*vi).IsD()) (*vi).Flags() |= FlagMask ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FaceSet(MeshType &m, unsigned int FlagMask)
|
static void FaceSet(MeshType &m, unsigned int FlagMask)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceFlags(m)) throw vcg::MissingComponentException("FaceFlags");
|
tri::RequirePerFaceFlags(m);
|
||||||
for(FaceIterator fi=m.face.begin(); fi!=m.face.end(); ++fi)
|
for(FaceIterator fi=m.face.begin(); fi!=m.face.end(); ++fi)
|
||||||
if(!(*fi).IsD()) (*fi).Flags() |= FlagMask ;
|
if(!(*fi).IsD()) (*fi).Flags() |= FlagMask ;
|
||||||
}
|
}
|
||||||
|
@ -133,8 +132,9 @@ public:
|
||||||
*/
|
*/
|
||||||
static void FaceBorderFromFF(MeshType &m)
|
static void FaceBorderFromFF(MeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceFlags(m)) throw vcg::MissingComponentException("FaceFlags");
|
tri::RequirePerFaceFlags(m);
|
||||||
if(!HasFFAdjacency(m)) throw vcg::MissingComponentException("FFAdj");
|
tri::RequireFFAdjacency(m);
|
||||||
|
|
||||||
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)if(!(*fi).IsD())
|
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)if(!(*fi).IsD())
|
||||||
for(int j=0;j<3;++j)
|
for(int j=0;j<3;++j)
|
||||||
{
|
{
|
||||||
|
@ -146,8 +146,8 @@ public:
|
||||||
|
|
||||||
static void FaceBorderFromVF(MeshType &m)
|
static void FaceBorderFromVF(MeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceFlags(m)) throw vcg::MissingComponentException("FaceFlags");
|
tri::RequirePerFaceFlags(m);
|
||||||
if(!HasVFAdjacency(m)) throw vcg::MissingComponentException("VFAdj");
|
tri::RequireVFAdjacency(m);
|
||||||
|
|
||||||
FaceClearB(m);
|
FaceClearB(m);
|
||||||
int visitedBit=VertexType::NewBitFlag();
|
int visitedBit=VertexType::NewBitFlag();
|
||||||
|
@ -232,7 +232,7 @@ public:
|
||||||
// versione minimale che non calcola i complex flag.
|
// versione minimale che non calcola i complex flag.
|
||||||
static void VertexBorderFromNone(MeshType &m)
|
static void VertexBorderFromNone(MeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerVertexFlags(m)) throw vcg::MissingComponentException("VertexFlags");
|
tri::RequirePerVertexFlags(m);
|
||||||
|
|
||||||
std::vector<EdgeSorter> e;
|
std::vector<EdgeSorter> e;
|
||||||
typename UpdateMeshType::FaceIterator pf;
|
typename UpdateMeshType::FaceIterator pf;
|
||||||
|
@ -278,7 +278,7 @@ public:
|
||||||
/// It has a O(fn log fn) complexity.
|
/// It has a O(fn log fn) complexity.
|
||||||
static void FaceBorderFromNone(MeshType &m)
|
static void FaceBorderFromNone(MeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceFlags(m)) throw vcg::MissingComponentException("FaceFlags");
|
tri::RequirePerFaceFlags(m);
|
||||||
|
|
||||||
std::vector<EdgeSorter> e;
|
std::vector<EdgeSorter> e;
|
||||||
typename UpdateMeshType::FaceIterator pf;
|
typename UpdateMeshType::FaceIterator pf;
|
||||||
|
@ -331,9 +331,8 @@ public:
|
||||||
/// Compute the PerVertex Border flag deriving it from the border flag of faces
|
/// Compute the PerVertex Border flag deriving it from the border flag of faces
|
||||||
static void VertexBorderFromFace(MeshType &m)
|
static void VertexBorderFromFace(MeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceFlags(m)) throw vcg::MissingComponentException("FaceFlags");
|
tri::RequirePerFaceFlags(m);
|
||||||
if(!HasPerVertexFlags(m)) throw vcg::MissingComponentException("VertexFlags");
|
tri::RequirePerVertexFlags(m);
|
||||||
|
|
||||||
for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
|
for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
(*vi).ClearB();
|
(*vi).ClearB();
|
||||||
|
|
||||||
|
@ -351,8 +350,8 @@ public:
|
||||||
//
|
//
|
||||||
static void FaceFauxCrease(MeshType &m,float AngleRad)
|
static void FaceFauxCrease(MeshType &m,float AngleRad)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceFlags(m)) throw vcg::MissingComponentException("FaceFlags");
|
tri::RequirePerFaceFlags(m);
|
||||||
if(!HasFFAdjacency(m)) throw vcg::MissingComponentException("FFAdj");
|
tri::RequireFFAdjacency(m);
|
||||||
|
|
||||||
typename MeshType::FaceIterator f;
|
typename MeshType::FaceIterator f;
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ static void PerFace(ComputeMeshType &m)
|
||||||
*/
|
*/
|
||||||
static void PerVertexFromCurrentFaceNormal(ComputeMeshType &m)
|
static void PerVertexFromCurrentFaceNormal(ComputeMeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerVertexNormal(m)) throw vcg::MissingComponentException("PerVertexNormal");
|
tri::RequirePerVertexNormal(m);
|
||||||
|
|
||||||
VertexIterator vi;
|
VertexIterator vi;
|
||||||
for(vi=m.vert.begin();vi!=m.vert.end();++vi)
|
for(vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
|
@ -191,8 +191,8 @@ static void PerVertexFromCurrentFaceNormal(ComputeMeshType &m)
|
||||||
*/
|
*/
|
||||||
static void PerFaceFromCurrentVertexNormal(ComputeMeshType &m)
|
static void PerFaceFromCurrentVertexNormal(ComputeMeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerVertexNormal(m) ) throw vcg::MissingComponentException("PerVertexNormal");
|
tri::RequirePerVertexNormal(m);
|
||||||
if(!HasPerFaceNormal(m)) throw vcg::MissingComponentException("PerFaceNormal");
|
tri::RequirePerFaceNormal(m);
|
||||||
for (FaceIterator fi=m.face.begin(); fi!=m.face.end(); ++fi)
|
for (FaceIterator fi=m.face.begin(); fi!=m.face.end(); ++fi)
|
||||||
if( !(*fi).IsD())
|
if( !(*fi).IsD())
|
||||||
{
|
{
|
||||||
|
@ -208,7 +208,7 @@ static void PerFaceFromCurrentVertexNormal(ComputeMeshType &m)
|
||||||
/// \brief Normalize the length of the vertex normals.
|
/// \brief Normalize the length of the vertex normals.
|
||||||
static void NormalizePerVertex(ComputeMeshType &m)
|
static void NormalizePerVertex(ComputeMeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerVertexNormal(m)) throw vcg::MissingComponentException("PerVertexNormal");
|
tri::RequirePerVertexNormal(m);
|
||||||
for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
|
for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
if( !(*vi).IsD() && (*vi).IsRW() )
|
if( !(*vi).IsD() && (*vi).IsRW() )
|
||||||
(*vi).N().Normalize();
|
(*vi).N().Normalize();
|
||||||
|
@ -217,7 +217,7 @@ static void NormalizePerVertex(ComputeMeshType &m)
|
||||||
/// \brief Normalize the length of the face normals.
|
/// \brief Normalize the length of the face normals.
|
||||||
static void NormalizePerFace(ComputeMeshType &m)
|
static void NormalizePerFace(ComputeMeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceNormal(m)) throw vcg::MissingComponentException("PerFaceNormal");
|
tri::RequirePerFaceNormal(m);
|
||||||
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
|
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
|
||||||
if( !(*fi).IsD() ) (*fi).N().Normalize();
|
if( !(*fi).IsD() ) (*fi).N().Normalize();
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ static void NormalizePerFace(ComputeMeshType &m)
|
||||||
/// \brief Set the length of the face normals to their area (without recomputing their directions).
|
/// \brief Set the length of the face normals to their area (without recomputing their directions).
|
||||||
static void NormalizePerFaceByArea(ComputeMeshType &m)
|
static void NormalizePerFaceByArea(ComputeMeshType &m)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceNormal(m)) throw vcg::MissingComponentException("PerFaceNormal");
|
tri::RequirePerFaceNormal(m);
|
||||||
FaceIterator fi;
|
FaceIterator fi;
|
||||||
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
||||||
if( !(*fi).IsD() )
|
if( !(*fi).IsD() )
|
||||||
|
@ -288,7 +288,7 @@ static void PerBitQuadFaceNormalized(ComputeMeshType &m)
|
||||||
/// \brief Multiply the vertex normals by the matrix passed. By default, the scale component is removed.
|
/// \brief Multiply the vertex normals by the matrix passed. By default, the scale component is removed.
|
||||||
static void PerVertexMatrix(ComputeMeshType &m, const Matrix44<ScalarType> &mat, bool remove_scaling= true)
|
static void PerVertexMatrix(ComputeMeshType &m, const Matrix44<ScalarType> &mat, bool remove_scaling= true)
|
||||||
{
|
{
|
||||||
if(!HasPerVertexNormal(m)) throw vcg::MissingComponentException("PerVertexNormal");
|
tri::RequirePerVertexNormal(m);
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
Matrix33<ScalarType> mat33(mat,3);
|
Matrix33<ScalarType> mat33(mat,3);
|
||||||
|
@ -309,7 +309,7 @@ static void PerVertexMatrix(ComputeMeshType &m, const Matrix44<ScalarType> &mat,
|
||||||
/// \brief Multiply the face normals by the matrix passed. By default, the scale component is removed.
|
/// \brief Multiply the face normals by the matrix passed. By default, the scale component is removed.
|
||||||
static void PerFaceMatrix(ComputeMeshType &m, const Matrix44<ScalarType> &mat, bool remove_scaling= true)
|
static void PerFaceMatrix(ComputeMeshType &m, const Matrix44<ScalarType> &mat, bool remove_scaling= true)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceNormal(m)) throw vcg::MissingComponentException("PerFaceNormal");
|
tri::RequirePerFaceNormal(m);
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
Matrix33<ScalarType> mat33(mat,3);
|
Matrix33<ScalarType> mat33(mat,3);
|
||||||
|
@ -334,8 +334,8 @@ static void PerFaceMatrix(ComputeMeshType &m, const Matrix44<ScalarType> &mat, b
|
||||||
/// It requires FFAdjacency.
|
/// It requires FFAdjacency.
|
||||||
static void PerWedgeCrease(ComputeMeshType &m, ScalarType angleRad)
|
static void PerWedgeCrease(ComputeMeshType &m, ScalarType angleRad)
|
||||||
{
|
{
|
||||||
if(!HasPerWedgeNormal(m) ) throw vcg::MissingComponentException("PerWedgeNormal");
|
tri::RequirePerFaceWedgeNormal(m);
|
||||||
if(!HasFFAdjacency(m)) throw vcg::MissingComponentException("Face-Face Adjacency");
|
tri::RequireFFAdjacency(m);
|
||||||
|
|
||||||
ScalarType cosangle=math::Cos(angleRad);
|
ScalarType cosangle=math::Cos(angleRad);
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ static void PerWedgeCrease(ComputeMeshType &m, ScalarType angleRad)
|
||||||
|
|
||||||
static void PerFaceRW(ComputeMeshType &m, bool normalize=false)
|
static void PerFaceRW(ComputeMeshType &m, bool normalize=false)
|
||||||
{
|
{
|
||||||
if(!HasPerFaceNormal(m)) throw vcg::MissingComponentException("PerFaceNormal");
|
tri::RequirePerFaceNormal(m);
|
||||||
FaceIterator f;
|
FaceIterator f;
|
||||||
bool cn = true;
|
bool cn = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue