better comments and corrected SelectVertexCornerBorder -> VertexCornerBorder

This commit is contained in:
Paolo Cignoni 2017-04-02 17:40:12 +02:00
parent 430810a9ac
commit 2793be26f6
2 changed files with 5 additions and 27 deletions

View File

@ -61,8 +61,7 @@ namespace tri
For example if you just want to get a vector with positions over the surface You have just to write For example if you just want to get a vector with positions over the surface You have just to write
vector<Point3f> myVec; vector<Point3f> myVec;
TrivialSampler<MyMesh> ts(myVec); SurfaceSampling<MyMesh, TrivialSampler<MyMesh> >::Montecarlo(M, TrivialSampler<MyMesh>(myVec), SampleNum);
SurfaceSampling<MyMesh, TrivialSampler<MyMesh> >::Montecarlo(M, ts, SampleNum);
**/ **/
@ -843,35 +842,13 @@ static void EdgeMeshUniform(MeshType &m, VertexSampler &ps, float radius, bool c
/// ///
/// It assumes that the border flag have been set over the mesh both for vertex and for faces. /// It assumes that the border flag have been set over the mesh both for vertex and for faces.
/// All the vertices on the border where the edges of the boundary of the surface forms an angle smaller than the given threshold are sampled. /// All the vertices on the border where the edges of the boundary of the surface forms an angle smaller than the given threshold are sampled.
/// /// It assumes that the Per-Vertex border Flag has been set.
static void VertexBorderCorner(MeshType & m, VertexSampler &ps, ScalarType angleRad) static void VertexBorderCorner(MeshType & m, VertexSampler &ps, ScalarType angleRad)
{ {
// typename MeshType::template PerVertexAttributeHandle<float> angleSumH = tri::Allocator<MeshType>:: template GetPerVertexAttribute<float> (m); vcg::tri::UpdateSelection<MeshType>::VertexCornerBorder(m,angleRad);
// for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
// angleSumH[vi]=0;
// for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
// {
// for(int i=0;i<3;++i)
// {
// angleSumH[fi->V(i)] += vcg::Angle(fi->P2(i) - fi->P0(i),fi->P1(i) - fi->P0(i));
// }
// }
// for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
// {
// if((angleSumH[vi]<angleRad && vi->IsB())||
// (angleSumH[vi]>(360-angleRad) && vi->IsB()))
// ps.AddVert(*vi);
// }
// tri::Allocator<MeshType>:: template DeletePerVertexAttribute<float> (m,angleSumH);
vcg::tri::UpdateFlags<MeshType>::FaceClearS(m);
vcg::tri::UpdateFlags<MeshType>::SelectVertexCornerBorder(m,angleRad);
for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
{ {
if(vi->IsS())ps.AddVert(*vi); if(vi->IsS()) ps.AddVert(*vi);
} }
} }

View File

@ -538,6 +538,7 @@ static size_t VertexInBox( MeshType & m, const Box3Type &bb, bool preserveSelect
/// \brief Select the border vertices that form a corner along the border /// \brief Select the border vertices that form a corner along the border
/// with an angle that is below a certain threshold (e.g. with 90 will select all the acute angles) /// with an angle that is below a certain threshold (e.g. with 90 will select all the acute angles)
/// It assumes that the Per-Vertex border Flag has been set.
static size_t VertexCornerBorder(MeshType &m, ScalarType angleRad, bool preserveSelection=false) static size_t VertexCornerBorder(MeshType &m, ScalarType angleRad, bool preserveSelection=false)
{ {
if(!preserveSelection) VertexClear(m); if(!preserveSelection) VertexClear(m);