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