And another one
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@909 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
cog[0] = cog[1] = cog[2] = valence = 0.0;
|
cog[0] = cog[1] = cog[2] = valence = 0.0;
|
||||||
|
|
||||||
for (vv_it=mesh.vv_iter(v_it.handle()); vv_it; ++vv_it)
|
for (vv_it=mesh.vv_iter(*v_it); vv_it; ++vv_it)
|
||||||
{
|
{
|
||||||
cog += mesh.point( *vv_it );
|
cog += mesh.point( *vv_it );
|
||||||
++valence;
|
++valence;
|
||||||
@@ -110,8 +110,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it)
|
for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it)
|
||||||
if (!mesh.is_boundary(v_it.handle()))
|
if (!mesh.is_boundary(*v_it))
|
||||||
mesh.set_point( v_it.handle(), mesh.data(v_it).cog());
|
mesh.set_point( *v_it, mesh.data(*v_it).cog());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -786,7 +786,7 @@ This example shows how to iterate over all faces of a mesh:
|
|||||||
MyMesh mesh;
|
MyMesh mesh;
|
||||||
|
|
||||||
for(MyMesh::FaceIter f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
|
for(MyMesh::FaceIter f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
|
||||||
std::cout << "The face's valence is " << mesh.valence( f_it.handle() ) << std::endl;
|
std::cout << "The face's valence is " << mesh.valence( *f_it ) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
\endcode
|
\endcode
|
||||||
@@ -890,7 +890,7 @@ MyMesh mesh;
|
|||||||
MyMesh::FaceHalfedgeIter fh_it = mesh.fh_iter(faceHandle);
|
MyMesh::FaceHalfedgeIter fh_it = mesh.fh_iter(faceHandle);
|
||||||
|
|
||||||
for(; fh_it; ++fh_it) {
|
for(; fh_it; ++fh_it) {
|
||||||
std::cout << "Halfedge has handle " << fh_it.handle() << std::endl;
|
std::cout << "Halfedge has handle " << *fh_it << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
\endcode
|
\endcode
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ mesh.add_face(face_vhandles);
|
|||||||
// Find this edge and then flip it
|
// Find this edge and then flip it
|
||||||
for(TriMesh::EdgeIter it = mesh.edges_begin(); it != mesh.edges_end(); ++it) {
|
for(TriMesh::EdgeIter it = mesh.edges_begin(); it != mesh.edges_end(); ++it) {
|
||||||
|
|
||||||
if(!mesh.is_boundary(it.handle())) {
|
if(!mesh.is_boundary(*it)) {
|
||||||
// Flip edge
|
// Flip edge
|
||||||
mesh.flip(it.handle());
|
mesh.flip(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,11 +116,11 @@ mesh.add_face(face_vhandles);
|
|||||||
// and vhandle[3]
|
// and vhandle[3]
|
||||||
for(PolyMesh::HalfedgeIter it = mesh.halfedges_begin(); it != mesh.halfedges_end(); ++it) {
|
for(PolyMesh::HalfedgeIter it = mesh.halfedges_begin(); it != mesh.halfedges_end(); ++it) {
|
||||||
|
|
||||||
if(to_vertex_handle(it.handle()) == vhandle[3] &&
|
if(to_vertex_handle(*it) == vhandle[3] &&
|
||||||
from_vertex_handle(it.handle()) == vhandle[2]) {
|
from_vertex_handle(*it) == vhandle[2]) {
|
||||||
|
|
||||||
// Collapse edge
|
// Collapse edge
|
||||||
mesh.collapse(it.handle());
|
mesh.collapse(*it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,12 +134,12 @@ MeshViewerWidgetT<M>::open_mesh(const char* _filename, IO::Options _opt)
|
|||||||
|
|
||||||
Vec3f bbMin, bbMax;
|
Vec3f bbMin, bbMax;
|
||||||
|
|
||||||
bbMin = bbMax = OpenMesh::vector_cast<Vec3f>(mesh_.point(vIt));
|
bbMin = bbMax = OpenMesh::vector_cast<Vec3f>(mesh_.point(*vIt));
|
||||||
|
|
||||||
for (size_t count=0; vIt!=vEnd; ++vIt, ++count)
|
for (size_t count=0; vIt!=vEnd; ++vIt, ++count)
|
||||||
{
|
{
|
||||||
bbMin.minimize( OpenMesh::vector_cast<Vec3f>(mesh_.point(vIt)));
|
bbMin.minimize( OpenMesh::vector_cast<Vec3f>(mesh_.point(*vIt)));
|
||||||
bbMax.maximize( OpenMesh::vector_cast<Vec3f>(mesh_.point(vIt)));
|
bbMax.maximize( OpenMesh::vector_cast<Vec3f>(mesh_.point(*vIt)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -164,10 +164,10 @@ MeshViewerWidgetT<M>::open_mesh(const char* _filename, IO::Options _opt)
|
|||||||
for (;f_it != mesh_.faces_end(); ++f_it)
|
for (;f_it != mesh_.faces_end(); ++f_it)
|
||||||
{
|
{
|
||||||
typename Mesh::Point v(0,0,0);
|
typename Mesh::Point v(0,0,0);
|
||||||
for( fv_it=mesh_.fv_iter(f_it); fv_it.is_valid(); ++fv_it)
|
for( fv_it=mesh_.fv_iter(*f_it); fv_it.is_valid(); ++fv_it)
|
||||||
v += OpenMesh::vector_cast<typename Mesh::Normal>(mesh_.point(*fv_it));
|
v += OpenMesh::vector_cast<typename Mesh::Normal>(mesh_.point(*fv_it));
|
||||||
v *= 1.0f/3.0f;
|
v *= 1.0f/3.0f;
|
||||||
mesh_.property( fp_normal_base_, f_it ) = v;
|
mesh_.property( fp_normal_base_, *f_it ) = v;
|
||||||
}
|
}
|
||||||
t.stop();
|
t.stop();
|
||||||
std::clog << "Computed base point for displaying face normals ["
|
std::clog << "Computed base point for displaying face normals ["
|
||||||
@@ -337,7 +337,7 @@ MeshViewerWidgetT<M>::draw_openmesh(const std::string& _draw_mode)
|
|||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
for (; fIt!=fEnd; ++fIt)
|
for (; fIt!=fEnd; ++fIt)
|
||||||
{
|
{
|
||||||
glNormal3fv( &mesh_.normal(fIt)[0] );
|
glNormal3fv( &mesh_.normal(*fIt)[0] );
|
||||||
|
|
||||||
fvIt = mesh_.cfv_iter(*fIt);
|
fvIt = mesh_.cfv_iter(*fIt);
|
||||||
glVertex3fv( &mesh_.point(*fvIt)[0] );
|
glVertex3fv( &mesh_.point(*fvIt)[0] );
|
||||||
@@ -665,8 +665,8 @@ MeshViewerWidgetT<M>::draw_scene(const std::string& _draw_mode)
|
|||||||
glColor3f(1.000f, 0.803f, 0.027f); // orange
|
glColor3f(1.000f, 0.803f, 0.027f); // orange
|
||||||
for(vit=mesh_.vertices_begin(); vit!=mesh_.vertices_end(); ++vit)
|
for(vit=mesh_.vertices_begin(); vit!=mesh_.vertices_end(); ++vit)
|
||||||
{
|
{
|
||||||
glVertex( vit );
|
glVertex( *vit );
|
||||||
glVertex( mesh_.point( vit ) + normal_scale_*mesh_.normal( vit ) );
|
glVertex( mesh_.point( *vit ) + normal_scale_*mesh_.normal( *vit ) );
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
@@ -679,9 +679,9 @@ MeshViewerWidgetT<M>::draw_scene(const std::string& _draw_mode)
|
|||||||
glColor3f(0.705f, 0.976f, 0.270f); // greenish
|
glColor3f(0.705f, 0.976f, 0.270f); // greenish
|
||||||
for(fit=mesh_.faces_begin(); fit!=mesh_.faces_end(); ++fit)
|
for(fit=mesh_.faces_begin(); fit!=mesh_.faces_end(); ++fit)
|
||||||
{
|
{
|
||||||
glVertex( mesh_.property(fp_normal_base_, fit) );
|
glVertex( mesh_.property(fp_normal_base_, *fit) );
|
||||||
glVertex( mesh_.property(fp_normal_base_, fit) +
|
glVertex( mesh_.property(fp_normal_base_, *fit) +
|
||||||
normal_scale_*mesh_.normal( fit ) );
|
normal_scale_*mesh_.normal( *fit ) );
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,17 +291,17 @@ get_active_cuts(const VHierarchyNodeHandle _node_handle,
|
|||||||
vr = VDPMMesh::InvalidVertexHandle;
|
vr = VDPMMesh::InvalidVertexHandle;
|
||||||
|
|
||||||
for (vv_it=mesh_.vv_iter(vhierarchy_.vertex_handle(_node_handle));
|
for (vv_it=mesh_.vv_iter(vhierarchy_.vertex_handle(_node_handle));
|
||||||
vv_it; ++vv_it)
|
vv_it.is_valid(); ++vv_it)
|
||||||
{
|
{
|
||||||
nnode_handle = mesh_.data(*vv_it).vhierarchy_node_handle();
|
nnode_handle = mesh_.data(*vv_it).vhierarchy_node_handle();
|
||||||
nnode_index = vhierarchy_.node_index(nnode_handle);
|
nnode_index = vhierarchy_.node_index(nnode_handle);
|
||||||
|
|
||||||
if (vl == VDPMMesh::InvalidVertexHandle &&
|
if (vl == VDPMMesh::InvalidVertexHandle &&
|
||||||
vhierarchy_.is_ancestor(nnode_index, fund_lcut_index) == true)
|
vhierarchy_.is_ancestor(nnode_index, fund_lcut_index) == true)
|
||||||
vl = *vv_it;
|
vl = *vv_it;
|
||||||
|
|
||||||
if (vr == VDPMMesh::InvalidVertexHandle &&
|
if (vr == VDPMMesh::InvalidVertexHandle &&
|
||||||
vhierarchy_.is_ancestor(nnode_index, fund_rcut_index) == true)
|
vhierarchy_.is_ancestor(nnode_index, fund_rcut_index) == true)
|
||||||
vr = *vv_it;
|
vr = *vv_it;
|
||||||
|
|
||||||
/*if (vl == VDPMMesh::InvalidVertexHandle && nnode_index.is_ancestor_index(fund_lcut_index) == true)
|
/*if (vl == VDPMMesh::InvalidVertexHandle && nnode_index.is_ancestor_index(fund_lcut_index) == true)
|
||||||
@@ -310,7 +310,7 @@ get_active_cuts(const VHierarchyNodeHandle _node_handle,
|
|||||||
vr = *vv_it;*/
|
vr = *vv_it;*/
|
||||||
|
|
||||||
if (vl != VDPMMesh::InvalidVertexHandle &&
|
if (vl != VDPMMesh::InvalidVertexHandle &&
|
||||||
vr != VDPMMesh::InvalidVertexHandle)
|
vr != VDPMMesh::InvalidVertexHandle)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ size_t DecimaterT<Mesh>::decimate(size_t _n_collapses) {
|
|||||||
heap_->reserve(mesh_.n_vertices());
|
heap_->reserve(mesh_.n_vertices());
|
||||||
|
|
||||||
for (v_it = mesh_.vertices_begin(); v_it != v_end; ++v_it) {
|
for (v_it = mesh_.vertices_begin(); v_it != v_end; ++v_it) {
|
||||||
heap_->reset_heap_position(v_it.handle());
|
heap_->reset_heap_position(*v_it);
|
||||||
if (!mesh_.status(*v_it).deleted())
|
if (!mesh_.status(*v_it).deleted())
|
||||||
heap_vertex(*v_it);
|
heap_vertex(*v_it);
|
||||||
}
|
}
|
||||||
@@ -253,9 +253,9 @@ size_t DecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) {
|
|||||||
heap_->reserve(mesh_.n_vertices());
|
heap_->reserve(mesh_.n_vertices());
|
||||||
|
|
||||||
for (v_it = mesh_.vertices_begin(); v_it != v_end; ++v_it) {
|
for (v_it = mesh_.vertices_begin(); v_it != v_end; ++v_it) {
|
||||||
heap_->reset_heap_position(v_it.handle());
|
heap_->reset_heap_position(*v_it);
|
||||||
if (!mesh_.status(v_it).deleted())
|
if (!mesh_.status(v_it).deleted())
|
||||||
heap_vertex(v_it.handle());
|
heap_vertex(*v_it);
|
||||||
}
|
}
|
||||||
|
|
||||||
// process heap
|
// process heap
|
||||||
@@ -295,8 +295,8 @@ size_t DecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) {
|
|||||||
// update triangle normals
|
// update triangle normals
|
||||||
vf_it = mesh_.vf_iter(ci.v1);
|
vf_it = mesh_.vf_iter(ci.v1);
|
||||||
for (; vf_it; ++vf_it)
|
for (; vf_it; ++vf_it)
|
||||||
if (!mesh_.status(vf_it).deleted())
|
if (!mesh_.status(*vf_it).deleted())
|
||||||
mesh_.set_normal(vf_it, mesh_.calc_face_normal(vf_it.handle()));
|
mesh_.set_normal(*vf_it, mesh_.calc_face_normal(*vf_it));
|
||||||
|
|
||||||
// post-process collapse
|
// post-process collapse
|
||||||
this->postprocess_collapse(ci);
|
this->postprocess_collapse(ci);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ initialize()
|
|||||||
v_end = Base::mesh().vertices_end();
|
v_end = Base::mesh().vertices_end();
|
||||||
|
|
||||||
for (; v_it != v_end; ++v_it)
|
for (; v_it != v_end; ++v_it)
|
||||||
Base::mesh().property(quadrics_, v_it).clear();
|
Base::mesh().property(quadrics_, *v_it).clear();
|
||||||
|
|
||||||
// calc (normal weighted) quadric
|
// calc (normal weighted) quadric
|
||||||
typename Mesh::FaceIter f_it = Base::mesh().faces_begin(),
|
typename Mesh::FaceIter f_it = Base::mesh().faces_begin(),
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ CatmullClarkT<MeshType,RealType>::subdivide( MeshType& _m , size_t _n , const bo
|
|||||||
// Commit changes in geometry
|
// Commit changes in geometry
|
||||||
v_itr = _m.vertices_begin();
|
v_itr = _m.vertices_begin();
|
||||||
for ( ; v_itr != v_end; ++v_itr)
|
for ( ; v_itr != v_end; ++v_itr)
|
||||||
_m.set_point(v_itr, _m.property( vp_pos_, v_itr ) );
|
_m.set_point(*v_itr, _m.property( vp_pos_, *v_itr ) );
|
||||||
|
|
||||||
// Split each edge at midpoint stored in edge property ep_pos_;
|
// Split each edge at midpoint stored in edge property ep_pos_;
|
||||||
// Attention! Creating new edges, hence make sure the loop ends correctly.
|
// Attention! Creating new edges, hence make sure the loop ends correctly.
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ bool CompositeT<MeshType,RealType>::prepare( MeshType& _m )
|
|||||||
typename MeshType::VertexIter v_it(_m.vertices_begin());
|
typename MeshType::VertexIter v_it(_m.vertices_begin());
|
||||||
|
|
||||||
for (; v_it != _m.vertices_end(); ++v_it)
|
for (; v_it != _m.vertices_end(); ++v_it)
|
||||||
_m.data(v_it).set_position(_m.point(*v_it));
|
_m.data(*v_it).set_position(_m.point(*v_it));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ void CompositeT<MeshType,RealType>::Tvv3()
|
|||||||
// set new positions for vertices
|
// set new positions for vertices
|
||||||
v_it = mesh_.vertices_begin();
|
v_it = mesh_.vertices_begin();
|
||||||
for (j = 0; j < n_vertices; ++j) {
|
for (j = 0; j < n_vertices; ++j) {
|
||||||
mesh_.data(v_it).set_position(mesh_.data(v_it).position() * 3.0);
|
mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * 3.0);
|
||||||
++v_it;
|
++v_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ void CompositeT<MeshType,RealType>::Tvv4()
|
|||||||
// set new positions for vertices
|
// set new positions for vertices
|
||||||
v_it = mesh_.vertices_begin();
|
v_it = mesh_.vertices_begin();
|
||||||
for (j = 0; j < n_vertices; ++j) {
|
for (j = 0; j < n_vertices; ++j) {
|
||||||
mesh_.data(v_it).set_position(mesh_.data(v_it).position() * 4.0);
|
mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * 4.0);
|
||||||
++v_it;
|
++v_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,11 +298,11 @@ void CompositeT<MeshType,RealType>::VF()
|
|||||||
cog = zero_point;
|
cog = zero_point;
|
||||||
|
|
||||||
for (fv_it = mesh_.fv_iter(*f_it); fv_it.is_valid(); ++fv_it) {
|
for (fv_it = mesh_.fv_iter(*f_it); fv_it.is_valid(); ++fv_it) {
|
||||||
cog += mesh_.data(fv_it).position();
|
cog += mesh_.data(*fv_it).position();
|
||||||
++valence;
|
++valence;
|
||||||
}
|
}
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
mesh_.data(f_it).set_position(cog);
|
mesh_.data(*f_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ void CompositeT<MeshType,RealType>::FF()
|
|||||||
|
|
||||||
for (ff_it = mesh_.ff_iter(*f_it); ff_it.is_valid(); ++ff_it)
|
for (ff_it = mesh_.ff_iter(*f_it); ff_it.is_valid(); ++ff_it)
|
||||||
{
|
{
|
||||||
cog += mesh_.data(ff_it).position();
|
cog += mesh_.data(*ff_it).position();
|
||||||
++valence;
|
++valence;
|
||||||
}
|
}
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
@@ -451,7 +451,7 @@ void CompositeT<MeshType,RealType>::FF()
|
|||||||
for (f_it = mesh_.faces_end(); f_it != mesh_.faces_begin(); )
|
for (f_it = mesh_.faces_end(); f_it != mesh_.faces_begin(); )
|
||||||
{
|
{
|
||||||
--f_it;
|
--f_it;
|
||||||
mesh_.data(f_it).set_position(point_vector.back());
|
mesh_.data(*f_it).set_position(point_vector.back());
|
||||||
point_vector.pop_back();
|
point_vector.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -602,7 +602,7 @@ void CompositeT<MeshType,RealType>::FVc(Coeff& _coeff)
|
|||||||
if (valence > 0)
|
if (valence > 0)
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
|
|
||||||
mesh_.data(v_it).set_position(cog);
|
mesh_.data(*v_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,7 +614,7 @@ void CompositeT<MeshType,RealType>::FVc(scalar_t _c)
|
|||||||
|
|
||||||
unsigned int valence;
|
unsigned int valence;
|
||||||
typename MeshType::Point cog,
|
typename MeshType::Point cog,
|
||||||
zero_point(0.0, 0.0, 0.0);
|
zero_point(0.0, 0.0, 0.0);
|
||||||
typename MeshType::VertexOHalfedgeIter voh_it;
|
typename MeshType::VertexOHalfedgeIter voh_it;
|
||||||
typename MeshType::VertexIter v_it;
|
typename MeshType::VertexIter v_it;
|
||||||
|
|
||||||
@@ -631,14 +631,14 @@ void CompositeT<MeshType,RealType>::FVc(scalar_t _c)
|
|||||||
|
|
||||||
if (mesh_.face_handle(*voh_it).is_valid()) {
|
if (mesh_.face_handle(*voh_it).is_valid()) {
|
||||||
|
|
||||||
if (mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it))).is_valid()) {
|
if (mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it))).is_valid()) {
|
||||||
cog += mesh_.deref(mesh_.face_handle(*voh_it)).position() * _c;
|
cog += mesh_.deref(mesh_.face_handle(*voh_it)).position() * _c;
|
||||||
cog += mesh_.deref(mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it)))).position() * (1.0 - _c);
|
cog += mesh_.deref(mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it)))).position() * (1.0 - _c);
|
||||||
} else {
|
} else {
|
||||||
cog += mesh_.deref(mesh_.face_handle(*voh_it)).position();
|
cog += mesh_.deref(mesh_.face_handle(*voh_it)).position();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
--valence;
|
--valence;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,7 +683,7 @@ void CompositeT<MeshType,RealType>::VdE()
|
|||||||
|
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
|
|
||||||
mesh_.data(e_it).set_position(cog);
|
mesh_.data(*e_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,7 +716,7 @@ void CompositeT<MeshType,RealType>::VdEc(scalar_t _c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh_.data(e_it).set_position(cog);
|
mesh_.data(*e_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -776,7 +776,7 @@ void CompositeT<MeshType,RealType>::VdEg(scalar_t _gamma)
|
|||||||
cog += mesh_.data(mesh_.to_vertex_handle(heh)).position() * 2.0 * _gamma;
|
cog += mesh_.data(mesh_.to_vertex_handle(heh)).position() * 2.0 * _gamma;
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh_.data(e_it).set_position(cog);
|
mesh_.data(*e_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,7 +839,7 @@ void CompositeT<MeshType,RealType>::VdEg(Coeff& _coeff)
|
|||||||
cog += mesh_.data(mesh_.to_vertex_handle(heh)).position() * 2.0 * gamma;
|
cog += mesh_.data(mesh_.to_vertex_handle(heh)).position() * 2.0 * gamma;
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh_.data(e_it).set_position(cog);
|
mesh_.data(*e_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -867,7 +867,7 @@ void CompositeT<MeshType,RealType>::EV()
|
|||||||
|
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
|
|
||||||
mesh_.data(v_it).set_position(cog);
|
mesh_.data(*v_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,7 +903,7 @@ void CompositeT<MeshType,RealType>::EVc(Coeff& _coeff)
|
|||||||
|
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
|
|
||||||
mesh_.data(v_it).set_position(cog);
|
mesh_.data(*v_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,7 +933,7 @@ void CompositeT<MeshType,RealType>::EVc(scalar_t _c)
|
|||||||
|
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
|
|
||||||
mesh_.data(v_it).set_position(cog);
|
mesh_.data(*v_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -959,7 +959,7 @@ void CompositeT<MeshType,RealType>::EF()
|
|||||||
}
|
}
|
||||||
|
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
mesh_.data(f_it).set_position(cog);
|
mesh_.data(*f_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -989,7 +989,7 @@ void CompositeT<MeshType,RealType>::FE()
|
|||||||
}
|
}
|
||||||
|
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
mesh_.data(e_it).set_position(cog);
|
mesh_.data(*e_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1007,7 +1007,7 @@ void CompositeT<MeshType,RealType>::VE()
|
|||||||
cog = mesh_.data(mesh_.to_vertex_handle(mesh_.halfedge_handle(*e_it, 0))).position();
|
cog = mesh_.data(mesh_.to_vertex_handle(mesh_.halfedge_handle(*e_it, 0))).position();
|
||||||
cog += mesh_.data(mesh_.to_vertex_handle(mesh_.halfedge_handle(*e_it, 1))).position();
|
cog += mesh_.data(mesh_.to_vertex_handle(mesh_.halfedge_handle(*e_it, 1))).position();
|
||||||
cog /= 2.0;
|
cog /= 2.0;
|
||||||
mesh_.data(e_it).set_position(cog);
|
mesh_.data(*e_it).set_position(cog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1042,7 +1042,7 @@ void CompositeT<MeshType,RealType>::VV()
|
|||||||
for (v_it = mesh_.vertices_end(); v_it != mesh_.vertices_begin(); )
|
for (v_it = mesh_.vertices_end(); v_it != mesh_.vertices_begin(); )
|
||||||
{
|
{
|
||||||
--v_it;
|
--v_it;
|
||||||
mesh_.data(v_it).set_position(point_vector.back());
|
mesh_.data(*v_it).set_position(point_vector.back());
|
||||||
point_vector.pop_back();
|
point_vector.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1073,13 +1073,13 @@ void CompositeT<MeshType,RealType>::VVc(Coeff& _coeff)
|
|||||||
}
|
}
|
||||||
cog /= valence;
|
cog /= valence;
|
||||||
c = _coeff(valence);
|
c = _coeff(valence);
|
||||||
cog = cog * (1 - c) + mesh_.data(v_it).position() * c;
|
cog = cog * (1 - c) + mesh_.data(*v_it).position() * c;
|
||||||
point_vector.push_back(cog);
|
point_vector.push_back(cog);
|
||||||
}
|
}
|
||||||
for (v_it = mesh_.vertices_end(); v_it != mesh_.vertices_begin(); )
|
for (v_it = mesh_.vertices_end(); v_it != mesh_.vertices_begin(); )
|
||||||
{
|
{
|
||||||
--v_it;
|
--v_it;
|
||||||
mesh_.data(v_it).set_position(point_vector.back());
|
mesh_.data(*v_it).set_position(point_vector.back());
|
||||||
point_vector.pop_back();
|
point_vector.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1116,7 +1116,7 @@ void CompositeT<MeshType,RealType>::VVc(scalar_t _c)
|
|||||||
for (v_it = mesh_.vertices_end(); v_it != mesh_.vertices_begin(); ) {
|
for (v_it = mesh_.vertices_end(); v_it != mesh_.vertices_begin(); ) {
|
||||||
|
|
||||||
--v_it;
|
--v_it;
|
||||||
mesh_.data(v_it).set_position(point_vector.back());
|
mesh_.data(*v_it).set_position(point_vector.back());
|
||||||
point_vector.pop_back();
|
point_vector.pop_back();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1160,7 +1160,7 @@ void CompositeT<MeshType,RealType>::EdE()
|
|||||||
for (e_it = mesh_.edges_end(); e_it != mesh_.edges_begin(); )
|
for (e_it = mesh_.edges_end(); e_it != mesh_.edges_begin(); )
|
||||||
{
|
{
|
||||||
--e_it;
|
--e_it;
|
||||||
mesh_.data(e_it).set_position(point_vector.back());
|
mesh_.data(*e_it).set_position(point_vector.back());
|
||||||
point_vector.pop_back();
|
point_vector.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1204,7 +1204,7 @@ void CompositeT<MeshType,RealType>::EdEc(scalar_t _c)
|
|||||||
for (e_it = mesh_.edges_end(); e_it != mesh_.edges_begin(); ) {
|
for (e_it = mesh_.edges_end(); e_it != mesh_.edges_begin(); ) {
|
||||||
|
|
||||||
--e_it;
|
--e_it;
|
||||||
mesh_.data(e_it).set_position(point_vector.back());
|
mesh_.data(*e_it).set_position(point_vector.back());
|
||||||
point_vector.pop_back();
|
point_vector.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ protected:
|
|||||||
typename MeshType::VertexIter v_it;
|
typename MeshType::VertexIter v_it;
|
||||||
|
|
||||||
for (v_it=_m.vertices_begin(); v_it != _m.vertices_end(); ++v_it)
|
for (v_it=_m.vertices_begin(); v_it != _m.vertices_end(); ++v_it)
|
||||||
_m.set_point(*v_it, _m.data(v_it).position());
|
_m.set_point(*v_it, _m.data(*v_it).position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ protected:
|
|||||||
// Commit changes in geometry
|
// Commit changes in geometry
|
||||||
for ( vit = _m.vertices_begin();
|
for ( vit = _m.vertices_begin();
|
||||||
vit != _m.vertices_end(); ++vit) {
|
vit != _m.vertices_end(); ++vit) {
|
||||||
_m.set_point(vit, _m.property( vp_pos_, vit ) );
|
_m.set_point(*vit, _m.property( vp_pos_, *vit ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ protected:
|
|||||||
// Commit changes in geometry
|
// Commit changes in geometry
|
||||||
for ( vit = /*initialVerticesEnd;*/_m.vertices_begin();
|
for ( vit = /*initialVerticesEnd;*/_m.vertices_begin();
|
||||||
vit != _m.vertices_end(); ++vit)
|
vit != _m.vertices_end(); ++vit)
|
||||||
_m.set_point(vit, _m.property( vp_pos_, vit ) );
|
_m.set_point(*vit, _m.property( vp_pos_, *vit ) );
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUG)
|
#if defined(_DEBUG) || defined(DEBUG)
|
||||||
// Now we have an consistent mesh!
|
// Now we have an consistent mesh!
|
||||||
|
|||||||
@@ -212,16 +212,16 @@ protected:
|
|||||||
// tag existing edges
|
// tag existing edges
|
||||||
for (eit=_m.edges_begin(); eit != _m.edges_end();++eit)
|
for (eit=_m.edges_begin(); eit != _m.edges_end();++eit)
|
||||||
{
|
{
|
||||||
_m.status( eit ).set_tagged( true );
|
_m.status( *eit ).set_tagged( true );
|
||||||
if ( (gen%2) && _m.is_boundary(eit) )
|
if ( (gen%2) && _m.is_boundary(*eit) )
|
||||||
compute_new_boundary_points( _m, eit ); // *) creates new vertices
|
compute_new_boundary_points( _m, *eit ); // *) creates new vertices
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert new vertices, and store pos in vp_pos_
|
// insert new vertices, and store pos in vp_pos_
|
||||||
typename MeshType::FaceIter fend = _m.faces_end();
|
typename MeshType::FaceIter fend = _m.faces_end();
|
||||||
for (fit = _m.faces_begin();fit != fend; ++fit)
|
for (fit = _m.faces_begin();fit != fend; ++fit)
|
||||||
{
|
{
|
||||||
if (_m.is_boundary(fit))
|
if (_m.is_boundary(*fit))
|
||||||
{
|
{
|
||||||
if(gen%2)
|
if(gen%2)
|
||||||
_m.property(fp_pos_, *fit).invalidate();
|
_m.property(fp_pos_, *fit).invalidate();
|
||||||
@@ -312,13 +312,13 @@ protected:
|
|||||||
int nOrdinary = 0;
|
int nOrdinary = 0;
|
||||||
|
|
||||||
//check number of extraordinary vertices
|
//check number of extraordinary vertices
|
||||||
for(fvit = _m.fv_iter( fit ); fvit.is_valid(); ++fvit)
|
for(fvit = _m.fv_iter( *fit ); fvit.is_valid(); ++fvit)
|
||||||
if( (_m.valence(*fvit)) == 6 || _m.is_boundary(*fvit) )
|
if( (_m.valence(*fvit)) == 6 || _m.is_boundary(*fvit) )
|
||||||
++nOrdinary;
|
++nOrdinary;
|
||||||
|
|
||||||
if(nOrdinary==3)
|
if(nOrdinary==3)
|
||||||
{
|
{
|
||||||
for(fheit = _m.fh_iter( fit ); fheit.is_valid(); ++fheit)
|
for(fheit = _m.fh_iter( *fit ); fheit.is_valid(); ++fheit)
|
||||||
{
|
{
|
||||||
//one ring vertex has weight 32/81
|
//one ring vertex has weight 32/81
|
||||||
heh = *fheit;
|
heh = *fheit;
|
||||||
@@ -346,9 +346,9 @@ protected:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//only use irregular vertices:
|
//only use irregular vertices:
|
||||||
for(fheit = _m.fh_iter( fit ); fheit.is_valid(); ++fheit)
|
for(fheit = _m.fh_iter( *fit ); fheit.is_valid(); ++fheit)
|
||||||
{
|
{
|
||||||
vh = _m.to_vertex_handle(fheit);
|
vh = _m.to_vertex_handle(*fheit);
|
||||||
if( (_m.valence(vh) != 6) && (!_m.is_boundary(vh)) )
|
if( (_m.valence(vh) != 6) && (!_m.is_boundary(vh)) )
|
||||||
{
|
{
|
||||||
unsigned int K = _m.valence(vh);
|
unsigned int K = _m.valence(vh);
|
||||||
@@ -371,21 +371,21 @@ protected:
|
|||||||
//split faces
|
//split faces
|
||||||
for (fit = _m.faces_begin();fit != fend; ++fit)
|
for (fit = _m.faces_begin();fit != fend; ++fit)
|
||||||
{
|
{
|
||||||
if ( _m.is_boundary(fit) && (gen%2))
|
if ( _m.is_boundary(*fit) && (gen%2))
|
||||||
{
|
{
|
||||||
boundary_split( _m, fit );
|
boundary_split( _m, *fit );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(_m.property(fp_pos_, *fit).is_valid());
|
assert(_m.property(fp_pos_, *fit).is_valid());
|
||||||
_m.split( fit, _m.property(fp_pos_, *fit) );
|
_m.split( *fit, _m.property(fp_pos_, *fit) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flip old edges
|
// flip old edges
|
||||||
for (eit=_m.edges_begin(); eit != _m.edges_end(); ++eit)
|
for (eit=_m.edges_begin(); eit != _m.edges_end(); ++eit)
|
||||||
if ( _m.status( eit ).tagged() && !_m.is_boundary( eit ) )
|
if ( _m.status( *eit ).tagged() && !_m.is_boundary( *eit ) )
|
||||||
_m.flip(eit);
|
_m.flip(*eit);
|
||||||
|
|
||||||
// Now we have an consistent mesh!
|
// Now we have an consistent mesh!
|
||||||
ASSERT_CONSISTENCY( MeshType, _m );
|
ASSERT_CONSISTENCY( MeshType, _m );
|
||||||
@@ -455,7 +455,7 @@ private:
|
|||||||
typename MeshType::HalfedgeHandle heh;
|
typename MeshType::HalfedgeHandle heh;
|
||||||
|
|
||||||
// find boundary edge
|
// find boundary edge
|
||||||
for( fe_it=_m.fe_iter( _fh ); fe_it.is_valid() && !_m.is_boundary( fe_it ); ++fe_it ) {};
|
for( fe_it=_m.fe_iter( _fh ); fe_it.is_valid() && !_m.is_boundary( *fe_it ); ++fe_it ) {};
|
||||||
|
|
||||||
// use precomputed, already inserted but not linked vertices
|
// use precomputed, already inserted but not linked vertices
|
||||||
vhl = _m.property(ep_nv_, *fe_it).first;
|
vhl = _m.property(ep_nv_, *fe_it).first;
|
||||||
|
|||||||
@@ -175,20 +175,20 @@ protected:
|
|||||||
// tag existing edges
|
// tag existing edges
|
||||||
for (eit=_m.edges_begin(); eit != _m.edges_end();++eit)
|
for (eit=_m.edges_begin(); eit != _m.edges_end();++eit)
|
||||||
{
|
{
|
||||||
_m.status( eit ).set_tagged( true );
|
_m.status( *eit ).set_tagged( true );
|
||||||
if ( (gen%2) && _m.is_boundary(eit) )
|
if ( (gen%2) && _m.is_boundary(*eit) )
|
||||||
compute_new_boundary_points( _m, eit ); // *) creates new vertices
|
compute_new_boundary_points( _m, *eit ); // *) creates new vertices
|
||||||
}
|
}
|
||||||
|
|
||||||
// do relaxation of old vertices, but store new pos in property vp_pos_
|
// do relaxation of old vertices, but store new pos in property vp_pos_
|
||||||
|
|
||||||
for (vit=_m.vertices_begin(); vit!=_m.vertices_end(); ++vit)
|
for (vit=_m.vertices_begin(); vit!=_m.vertices_end(); ++vit)
|
||||||
{
|
{
|
||||||
if ( _m.is_boundary(vit) )
|
if ( _m.is_boundary(*vit) )
|
||||||
{
|
{
|
||||||
if ( gen%2 )
|
if ( gen%2 )
|
||||||
{
|
{
|
||||||
heh = _m.halfedge_handle(vit);
|
heh = _m.halfedge_handle(*vit);
|
||||||
if (heh.is_valid()) // skip isolated newly inserted vertices *)
|
if (heh.is_valid()) // skip isolated newly inserted vertices *)
|
||||||
{
|
{
|
||||||
typename OpenMesh::HalfedgeHandle
|
typename OpenMesh::HalfedgeHandle
|
||||||
@@ -201,28 +201,28 @@ protected:
|
|||||||
pos += _m.point(_m.from_vertex_handle(prev_heh));
|
pos += _m.point(_m.from_vertex_handle(prev_heh));
|
||||||
pos *= real_t(4.0);
|
pos *= real_t(4.0);
|
||||||
|
|
||||||
pos += real_t(19.0) * _m.point( vit );
|
pos += real_t(19.0) * _m.point( *vit );
|
||||||
pos *= _1over27;
|
pos *= _1over27;
|
||||||
|
|
||||||
_m.property( vp_pos_, vit ) = pos;
|
_m.property( vp_pos_, *vit ) = pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_m.property( vp_pos_, vit ) = _m.point( vit );
|
_m.property( vp_pos_, *vit ) = _m.point( *vit );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t valence=0;
|
size_t valence=0;
|
||||||
|
|
||||||
pos = zero;
|
pos = zero;
|
||||||
for ( vvit = _m.vv_iter(vit); vvit.is_valid(); ++vvit)
|
for ( vvit = _m.vv_iter(*vit); vvit.is_valid(); ++vvit)
|
||||||
{
|
{
|
||||||
pos += _m.point( vvit );
|
pos += _m.point( *vvit );
|
||||||
++valence;
|
++valence;
|
||||||
}
|
}
|
||||||
pos *= weights_[ valence ].second;
|
pos *= weights_[ valence ].second;
|
||||||
pos += weights_[ valence ].first * _m.point(vit);
|
pos += weights_[ valence ].first * _m.point(*vit);
|
||||||
_m.property( vp_pos_, vit ) = pos;
|
_m.property( vp_pos_, *vit ) = pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ protected:
|
|||||||
typename MeshType::FaceIter fend = _m.faces_end();
|
typename MeshType::FaceIter fend = _m.faces_end();
|
||||||
for (fit = _m.faces_begin();fit != fend; ++fit)
|
for (fit = _m.faces_begin();fit != fend; ++fit)
|
||||||
{
|
{
|
||||||
if ( (gen%2) && _m.is_boundary(fit))
|
if ( (gen%2) && _m.is_boundary(*fit))
|
||||||
{
|
{
|
||||||
boundary_split( _m, *fit );
|
boundary_split( _m, *fit );
|
||||||
}
|
}
|
||||||
@@ -238,23 +238,23 @@ protected:
|
|||||||
{
|
{
|
||||||
fvit = _m.fv_iter( *fit );
|
fvit = _m.fv_iter( *fit );
|
||||||
pos = _m.point( *fvit);
|
pos = _m.point( *fvit);
|
||||||
pos += _m.point(++fvit);
|
pos += _m.point(*(++fvit));
|
||||||
pos += _m.point(++fvit);
|
pos += _m.point(*(++fvit));
|
||||||
pos *= _1over3;
|
pos *= _1over3;
|
||||||
vh = _m.add_vertex( zero );
|
vh = _m.add_vertex( zero );
|
||||||
_m.property( vp_pos_, vh ) = pos;
|
_m.property( vp_pos_, vh ) = pos;
|
||||||
_m.split( fit, vh );
|
_m.split( *fit, vh );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// commit new positions (now iterating over all vertices)
|
// commit new positions (now iterating over all vertices)
|
||||||
for (vit=_m.vertices_begin();vit != _m.vertices_end(); ++vit)
|
for (vit=_m.vertices_begin();vit != _m.vertices_end(); ++vit)
|
||||||
_m.set_point(vit, _m.property( vp_pos_, vit ) );
|
_m.set_point(*vit, _m.property( vp_pos_, *vit ) );
|
||||||
|
|
||||||
// flip old edges
|
// flip old edges
|
||||||
for (eit=_m.edges_begin(); eit != _m.edges_end(); ++eit)
|
for (eit=_m.edges_begin(); eit != _m.edges_end(); ++eit)
|
||||||
if ( _m.status( eit ).tagged() && !_m.is_boundary( eit ) )
|
if ( _m.status( *eit ).tagged() && !_m.is_boundary( *eit ) )
|
||||||
_m.flip(eit);
|
_m.flip(*eit);
|
||||||
|
|
||||||
// Now we have an consistent mesh!
|
// Now we have an consistent mesh!
|
||||||
ASSERT_CONSISTENCY( MeshType, _m );
|
ASSERT_CONSISTENCY( MeshType, _m );
|
||||||
@@ -348,7 +348,7 @@ private:
|
|||||||
typename MeshType::HalfedgeHandle heh;
|
typename MeshType::HalfedgeHandle heh;
|
||||||
|
|
||||||
// find boundary edge
|
// find boundary edge
|
||||||
for( fe_it=_m.fe_iter( _fh ); fe_it.is_valid() && !_m.is_boundary( fe_it ); ++fe_it ) {};
|
for( fe_it=_m.fe_iter( _fh ); fe_it.is_valid() && !_m.is_boundary( *fe_it ); ++fe_it ) {};
|
||||||
|
|
||||||
// use precomputed, already inserted but not linked vertices
|
// use precomputed, already inserted but not linked vertices
|
||||||
vhl = _m.property(ep_nv_, *fe_it).first;
|
vhl = _m.property(ep_nv_, *fe_it).first;
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ check(unsigned int _targets, std::ostream& _os)
|
|||||||
|
|
||||||
if (_targets & CHECK_VERTICES)
|
if (_targets & CHECK_VERTICES)
|
||||||
{
|
{
|
||||||
typename Mesh::ConstVertexIter v_it(mesh_.vertices_begin()),
|
typename Mesh::ConstVertexIter v_it(mesh_.vertices_begin()), v_end(mesh_.vertices_end());
|
||||||
v_end(mesh_.vertices_end());
|
|
||||||
typename Mesh::VertexHandle vh;
|
typename Mesh::VertexHandle vh;
|
||||||
typename Mesh::ConstVertexVertexIter vv_it;
|
typename Mesh::ConstVertexVertexIter vv_it;
|
||||||
typename Mesh::HalfedgeHandle heh;
|
typename Mesh::HalfedgeHandle heh;
|
||||||
@@ -82,57 +81,56 @@ check(unsigned int _targets, std::ostream& _os)
|
|||||||
|
|
||||||
for (; v_it != v_end; ++v_it)
|
for (; v_it != v_end; ++v_it)
|
||||||
{
|
{
|
||||||
if (!is_deleted(v_it))
|
if (!is_deleted(*v_it))
|
||||||
{
|
{
|
||||||
vh = *v_it;
|
vh = *v_it;
|
||||||
|
|
||||||
|
|
||||||
/* The outgoing halfedge of a boundary vertex has to be a
|
/* The outgoing halfedge of a boundary vertex has to be a boundary halfedge */
|
||||||
boundary halfedge */
|
heh = mesh_.halfedge_handle(vh);
|
||||||
heh = mesh_.halfedge_handle(vh);
|
if (heh.is_valid() && !mesh_.is_boundary(heh))
|
||||||
if (heh.is_valid() && !mesh_.is_boundary(heh))
|
{
|
||||||
{
|
for (typename Mesh::ConstVertexOHalfedgeIter vh_it(mesh_, vh);
|
||||||
for (typename Mesh::ConstVertexOHalfedgeIter vh_it(mesh_, vh);
|
vh_it.is_valid(); ++vh_it)
|
||||||
vh_it.is_valid(); ++vh_it)
|
{
|
||||||
{
|
if (mesh_.is_boundary(*vh_it))
|
||||||
if (mesh_.is_boundary(*vh_it))
|
{
|
||||||
{
|
_os << "MeshChecker: vertex " << vh
|
||||||
_os << "MeshChecker: vertex " << vh
|
<< ": outgoing halfedge not on boundary error\n";
|
||||||
<< ": outgoing halfedge not on boundary error\n";
|
ok = false;
|
||||||
ok = false;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// outgoing halfedge has to refer back to vertex
|
// outgoing halfedge has to refer back to vertex
|
||||||
if (mesh_.halfedge_handle(vh).is_valid() &&
|
if (mesh_.halfedge_handle(vh).is_valid() &&
|
||||||
mesh_.from_vertex_handle(mesh_.halfedge_handle(vh)) != vh)
|
mesh_.from_vertex_handle(mesh_.halfedge_handle(vh)) != vh)
|
||||||
{
|
{
|
||||||
_os << "MeshChecker: vertex " << vh
|
_os << "MeshChecker: vertex " << vh
|
||||||
<< ": outgoing halfedge does not reference vertex\n";
|
<< ": outgoing halfedge does not reference vertex\n";
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// check whether circulators are still in order
|
// check whether circulators are still in order
|
||||||
vv_it = mesh_.cvv_iter(vh);
|
vv_it = mesh_.cvv_iter(vh);
|
||||||
for (count=0; vv_it.is_valid() && (count < max_valence); ++vv_it, ++count) {};
|
for (count=0; vv_it.is_valid() && (count < max_valence); ++vv_it, ++count) {};
|
||||||
if (count == max_valence)
|
if (count == max_valence)
|
||||||
{
|
{
|
||||||
_os << "MeshChecker: vertex " << vh
|
_os << "MeshChecker: vertex " << vh
|
||||||
<< ": ++circulator problem, one ring corrupt\n";
|
<< ": ++circulator problem, one ring corrupt\n";
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
vv_it = mesh_.cvv_iter(vh);
|
vv_it = mesh_.cvv_iter(vh);
|
||||||
for (count=0; vv_it.is_valid() && (count < max_valence); --vv_it, ++count) {};
|
for (count=0; vv_it.is_valid() && (count < max_valence); --vv_it, ++count) {};
|
||||||
if (count == max_valence)
|
if (count == max_valence)
|
||||||
{
|
{
|
||||||
_os << "MeshChecker: vertex " << vh
|
_os << "MeshChecker: vertex " << vh
|
||||||
<< ": --circulator problem, one ring corrupt\n";
|
<< ": --circulator problem, one ring corrupt\n";
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,7 +202,7 @@ check(unsigned int _targets, std::ostream& _os)
|
|||||||
|
|
||||||
for (; f_it != f_end; ++f_it)
|
for (; f_it != f_end; ++f_it)
|
||||||
{
|
{
|
||||||
if (!is_deleted(f_it))
|
if (!is_deleted(*f_it))
|
||||||
{
|
{
|
||||||
fh = *f_it;
|
fh = *f_it;
|
||||||
|
|
||||||
|
|||||||
@@ -119,15 +119,15 @@ build_strips()
|
|||||||
if (mesh_.has_face_status())
|
if (mesh_.has_face_status())
|
||||||
{
|
{
|
||||||
for (f_it=mesh_.faces_begin(); f_it!=f_end; ++f_it)
|
for (f_it=mesh_.faces_begin(); f_it!=f_end; ++f_it)
|
||||||
if (mesh_.status(f_it).hidden() || mesh_.status(f_it).deleted())
|
if (mesh_.status(*f_it).hidden() || mesh_.status(*f_it).deleted())
|
||||||
processed(f_it) = used(f_it) = true;
|
processed(*f_it) = used(*f_it) = true;
|
||||||
else
|
else
|
||||||
processed(f_it) = used(f_it) = false;
|
processed(*f_it) = used(*f_it) = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (f_it=mesh_.faces_begin(); f_it!=f_end; ++f_it)
|
for (f_it=mesh_.faces_begin(); f_it!=f_end; ++f_it)
|
||||||
processed(f_it) = used(f_it) = false;
|
processed(*f_it) = used(*f_it) = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ build_strips()
|
|||||||
{
|
{
|
||||||
// find start face
|
// find start face
|
||||||
for (; f_it!=f_end; ++f_it)
|
for (; f_it!=f_end; ++f_it)
|
||||||
if (!processed(f_it))
|
if (!processed(*f_it))
|
||||||
break;
|
break;
|
||||||
if (f_it==f_end) break; // stop if all have been processed
|
if (f_it==f_end) break; // stop if all have been processed
|
||||||
|
|
||||||
|
|||||||
@@ -219,19 +219,19 @@ TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, VertexOIncomingHalfedgeBoundary
|
|||||||
|
|
||||||
EXPECT_EQ(14, vih_it->idx() ) << "Index wrong in VertexIHalfedgeIter begin at initialization";
|
EXPECT_EQ(14, vih_it->idx() ) << "Index wrong in VertexIHalfedgeIter begin at initialization";
|
||||||
EXPECT_EQ(14, vih_end->idx() ) << "Index wrong in VertexIHalfedgeIter end at initialization";
|
EXPECT_EQ(14, vih_end->idx() ) << "Index wrong in VertexIHalfedgeIter end at initialization";
|
||||||
EXPECT_EQ(3, mesh_.face_handle(vih_it.handle()).idx() ) << "Corresponding face Index wrong in VertexIHalfedgeIter begin at initialization";
|
EXPECT_EQ(3, mesh_.face_handle(*vih_it).idx() ) << "Corresponding face Index wrong in VertexIHalfedgeIter begin at initialization";
|
||||||
EXPECT_TRUE(vih_it) << "Iterator invalid in VertexIHalfedgeIter at initialization";
|
EXPECT_TRUE(vih_it) << "Iterator invalid in VertexIHalfedgeIter at initialization";
|
||||||
|
|
||||||
++vih_it ;
|
++vih_it ;
|
||||||
|
|
||||||
EXPECT_EQ(2, vih_it->idx() ) << "Index wrong in VertexIHalfedgeIter step 1";
|
EXPECT_EQ(2, vih_it->idx() ) << "Index wrong in VertexIHalfedgeIter step 1";
|
||||||
EXPECT_EQ(0, mesh_.face_handle(vih_it.handle()).idx() ) << "Corresponding face Index wrong in VertexIHalfedgeIter step 1";
|
EXPECT_EQ(0, mesh_.face_handle(*vih_it).idx() ) << "Corresponding face Index wrong in VertexIHalfedgeIter step 1";
|
||||||
EXPECT_TRUE(vih_it) << "Iterator invalid in VertexIHalfedgeIter at step 1";
|
EXPECT_TRUE(vih_it) << "Iterator invalid in VertexIHalfedgeIter at step 1";
|
||||||
|
|
||||||
++vih_it ;
|
++vih_it ;
|
||||||
|
|
||||||
EXPECT_EQ(5, vih_it->idx() ) << "Index wrong in VertexIHalfedgeIter step 2";
|
EXPECT_EQ(5, vih_it->idx() ) << "Index wrong in VertexIHalfedgeIter step 2";
|
||||||
EXPECT_EQ(-1, mesh_.face_handle(vih_it.handle()).idx() ) << "Corresponding face Index wrong in VertexIHalfedgeIter step 2";
|
EXPECT_EQ(-1, mesh_.face_handle(*vih_it).idx() ) << "Corresponding face Index wrong in VertexIHalfedgeIter step 2";
|
||||||
EXPECT_TRUE(vih_it) << "Iterator invalid in VertexIHalfedgeIter at step 2";
|
EXPECT_TRUE(vih_it) << "Iterator invalid in VertexIHalfedgeIter at step 2";
|
||||||
|
|
||||||
++vih_it ;
|
++vih_it ;
|
||||||
|
|||||||
Reference in New Issue
Block a user