Commit 50dc9e84 authored by Jan Möbius's avatar Jan Möbius

Next change set for the new interface

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@902 fdac6126-5c0c-442c-9429-916003d36597
parent 29335262
......@@ -4,7 +4,7 @@ MyMesh mesh;
for (MyMesh::VertexIter v_it=mesh.vertices_sbegin(); v_it!=mesh.vertices_end(); ++v_it)
{
// circulate around the current vertex
for (MyMesh::VertexVertexIter vv_it=mesh.vv_iter(v_it.handle()); vv_it; ++vv_it)
for (MyMesh::VertexVertexIter vv_it=mesh.vv_iter(*v_it); vv_it.is_valid(); ++vv_it)
{
// do something with e.g. mesh.point(*vv_it)
}
......
......@@ -2,17 +2,17 @@ MyMesh mesh;
// iterate over all vertices
for (MyMesh::VertexIter v_it=mesh.vertices_begin(); v_it!=mesh.vertices_end(); ++v_it)
...; // do something with *v_it, v_it->, or v_it.handle()
...; // do something with *v_it, v_it->, or *v_it
// iterate over all halfedges
for (MyMesh::HalfedgeIter h_it=mesh.halfedges_begin(); h_it!=mesh.halfedges_end(); ++h_it)
...; // do something with *h_it, h_it->, or h_it.handle()
...; // do something with *h_it, h_it->, or *h_it
// iterate over all edges
for (MyMesh::EdgeIter e_it=mesh.edges_begin(); e_it!=mesh.edges_end(); ++e_it)
...; // do something with *e_it, e_it->, or e_it.handle()
...; // do something with *e_it, e_it->, or *e_it
// iterator over all faces
for (MyMesh::FaceIter f_it=mesh.faces_begin(); f_it!=mesh.faces_end(); ++f_it)
...; // do something with *f_it, f_it->, or f_it.handle()
...; // do something with *f_it, f_it->, or *f_it
// Get the halfedge handle of i.e. the halfedge
// that is associated to the first vertex
// of our set of vertices
PolyMesh::HalfedgeHandle heh = mesh.halfedge_handle(mesh.vertices_begin().handle());
PolyMesh::HalfedgeHandle heh = mesh.halfedge_handle(*(mesh.vertices_begin()));
// Now get the handle of its opposing halfedge
PolyMesh::HalfedgeHandle opposite_heh = mesh.opposite_halfedge_handle(heh);
......@@ -308,7 +308,7 @@ int main(int argc, char **argv)
if (mesh.data(f_it).state() < target1) {
++i;
fh = f_it.handle();
fh = *f_it;
timer2.start();
subdivider.refine(fh);
timer2.stop();
......@@ -318,7 +318,7 @@ int main(int argc, char **argv)
for (v_it = mesh.vertices_begin(); v_it != mesh.vertices_end(); ++v_it) {
if (mesh.data(v_it).state() < target2) {
vh = v_it.handle();
vh = *v_it;
timer2.cont();
subdivider.refine(vh);
timer2.stop();
......@@ -350,7 +350,7 @@ int main(int argc, char **argv)
// calculate quality
quality = 0.0;
fh = mesh.faces_begin().handle();
fh = *(mesh.faces_begin());
// check every face
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
......@@ -358,7 +358,7 @@ int main(int argc, char **argv)
face_quality = 0.0;
valence = 0;
for (ff_it = mesh.ff_iter(f_it.handle()); ff_it; ++ff_it) {
for (ff_it = mesh.ff_iter(*f_it); ff_it; ++ff_it) {
temp_quality = OpenMesh::dot( mesh.normal(f_it),
mesh.normal(ff_it) );
......@@ -383,9 +383,9 @@ int main(int argc, char **argv)
#define nheh next_halfedge_handle
#define tvh to_vertex_handle
#define fvh from_vertex_handle
p1 = mesh.point(mesh.tvh(mesh.heh(f_it.handle())));
p2 = mesh.point(mesh.fvh(mesh.heh(f_it.handle())));
p3 = mesh.point(mesh.tvh(mesh.nheh(mesh.heh(f_it.handle()))));
p1 = mesh.point(mesh.tvh(mesh.heh(*f_it)));
p2 = mesh.point(mesh.fvh(mesh.heh(*f_it)));
p3 = mesh.point(mesh.tvh(mesh.nheh(mesh.heh(*f_it))));
#undef heh
#undef nheh
#undef tvh
......@@ -397,10 +397,10 @@ int main(int argc, char **argv)
face_quality *= pow(double(area), double(.1));
//face_quality *= area;
if (face_quality >= quality && !mesh.is_boundary(f_it.handle()))
if (face_quality >= quality && !mesh.is_boundary(*f_it))
{
quality = face_quality;
fh = f_it.handle();
fh = *f_it;
}
}
......
......@@ -508,7 +508,7 @@ save_vd_prog_mesh(const std::string &_filename)
for (f_it=mesh_.faces_begin(); f_it!=mesh_.faces_end(); ++f_it) {
hh = mesh_.halfedge_handle(f_it.handle());
hh = mesh_.halfedge_handle(*f_it);
vh = mesh_.to_vertex_handle(hh);
fvi[0] = handle2index_map[vh];
......@@ -660,16 +660,16 @@ vdpm_analysis()
// initialize
for (h_it=mesh_.halfedges_begin(); h_it!=mesh_.halfedges_end(); ++h_it)
{
vh = mesh_.to_vertex_handle(h_it.handle());
vh = mesh_.to_vertex_handle(*h_it);
mesh_.data(h_it).set_vhierarchy_leaf_node_handle(mesh_.data(vh).vhierarchy_node_handle());
}
for (v_it=mesh_.vertices_begin(); v_it!=mesh_.vertices_end(); ++v_it)
{
VHierarchyNodeHandle
node_handle = mesh_.data(v_it.handle()).vhierarchy_node_handle();
node_handle = mesh_.data(*v_it).vhierarchy_node_handle();
vhierarchy_.node(node_handle).set_normal(mesh_.normal(v_it.handle()));
vhierarchy_.node(node_handle).set_normal(mesh_.normal(*v_it));
}
std::cout << "Start view-dependent PM analysis" << std::endl;
......@@ -859,7 +859,7 @@ compute_screen_space_error(VHierarchyNodeHandle node_handle, VHierarchyNodeHandl
for (vf_it=mesh_.vf_iter(vh); vf_it; ++vf_it)
{
heh = mesh_.halfedge_handle(vf_it.handle());
heh = mesh_.halfedge_handle(*vf_it);
tri[0] = mesh_.point(mesh_.to_vertex_handle(heh));
heh = mesh_.next_halfedge_handle(heh);
tri[1] = mesh_.point(mesh_.to_vertex_handle(heh));
......
......@@ -275,7 +275,7 @@ int main(int argc, char *argv[] )
timer.start();
MyMesh::VertexIter vit = mesh.vertices_begin();
for (; vit != mesh.vertices_end(); ++vit)
mesh.set_normal( vit.handle(), -mesh.normal( vit.handle() ) );
mesh.set_normal( *vit, -mesh.normal( *vit ) );
timer.stop();
std::cout << " " << mesh.n_vertices()
<< " vertex normals in " << timer.as_string() << std::endl;
......
......@@ -210,7 +210,7 @@ public:
_vhandles.clear();
for (typename Mesh::CFVIter fv_it=mesh_.cfv_iter(_fh); fv_it.is_valid(); ++fv_it)
{
_vhandles.push_back(fv_it.handle());
_vhandles.push_back(*fv_it);
++count;
}
return count;
......
......@@ -205,7 +205,7 @@ update_face_normals()
FaceIter f_it(Kernel::faces_begin()), f_end(Kernel::faces_end());
for (; f_it != f_end; ++f_it)
this->set_normal(f_it.handle(), calc_face_normal(f_it.handle()));
this->set_normal(*f_it, calc_face_normal(f_it.handle()));
}
......@@ -220,7 +220,7 @@ update_halfedge_normals(const double _feature_angle)
HalfedgeIter h_it(Kernel::halfedges_begin()), h_end(Kernel::halfedges_end());
for (; h_it != h_end; ++h_it)
this->set_normal(h_it.handle(), calc_halfedge_normal(h_it.handle(), _feature_angle));
this->set_normal(*h_it, calc_halfedge_normal(*h_it, _feature_angle));
}
......@@ -332,7 +332,7 @@ calc_vertex_normal_fast(VertexHandle _vh, Normal& _n) const
{
_n.vectorize(0.0);
for (ConstVertexFaceIter vf_it=this->cvf_iter(_vh); vf_it; ++vf_it)
_n += this->normal(vf_it.handle());
_n += this->normal(*vf_it);
}
//-----------------------------------------------------------------------------
......@@ -394,7 +394,7 @@ update_vertex_normals()
VertexIter v_it(Kernel::vertices_begin()), v_end(Kernel::vertices_end());
for (; v_it!=v_end; ++v_it)
this->set_normal(v_it.handle(), calc_vertex_normal(v_it.handle()));
this->set_normal(*v_it, calc_vertex_normal(*v_it));
}
//=============================================================================
......
......@@ -100,7 +100,7 @@ int main(int argc, char **argv)
{
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.is_valid(); ++vv_it)
{
cog += mesh.point( *vv_it );
++valence;
......@@ -110,8 +110,8 @@ int main(int argc, char **argv)
}
for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it)
if (!mesh.is_boundary(v_it.handle()))
mesh.set_point( v_it.handle(), mesh.data(v_it).cog());
if (!mesh.is_boundary(*v_it))
mesh.set_point( *v_it, mesh.data(v_it).cog());
}
......
......@@ -224,11 +224,11 @@ protected:
if (_m.is_boundary(fit))
{
if(gen%2)
_m.property(fp_pos_, fit.handle()).invalidate();
_m.property(fp_pos_, *fit).invalidate();
else
{
//find the interior boundary halfedge
for( heh = _m.halfedge_handle(fit.handle()); !_m.is_boundary( _m.opposite_halfedge_handle(heh) ); heh = _m.next_halfedge_handle(heh) )
for( heh = _m.halfedge_handle(*fit); !_m.is_boundary( _m.opposite_halfedge_handle(heh) ); heh = _m.next_halfedge_handle(heh) )
;
assert(_m.is_boundary( _m.opposite_halfedge_handle(heh) ));
pos = zero;
......@@ -303,7 +303,7 @@ protected:
}
}
vh = _m.add_vertex( pos );
_m.property(fp_pos_, fit.handle()) = vh;
_m.property(fp_pos_, *fit) = vh;
}
}
else
......@@ -312,16 +312,16 @@ protected:
int nOrdinary = 0;
//check number of extraordinary vertices
for(fvit = _m.fv_iter( fit ); fvit; ++fvit)
if( (_m.valence(fvit.handle())) == 6 || _m.is_boundary(fvit.handle()) )
for(fvit = _m.fv_iter( fit ); fvit.is_valid(); ++fvit)
if( (_m.valence(*fvit)) == 6 || _m.is_boundary(*fvit) )
++nOrdinary;
if(nOrdinary==3)
{
for(fheit = _m.fh_iter( fit ); fheit; ++fheit)
for(fheit = _m.fh_iter( fit ); fheit.is_valid(); ++fheit)
{
//one ring vertex has weight 32/81
heh = fheit.handle();
heh = *fheit;
assert(_m.to_vertex_handle(heh).is_valid());
pos += real_t(32.0/81) * _m.point(_m.to_vertex_handle(heh));
//tip vertex has weight -1/81
......@@ -346,14 +346,14 @@ protected:
else
{
//only use irregular vertices:
for(fheit = _m.fh_iter( fit ); fheit; ++fheit)
for(fheit = _m.fh_iter( fit ); fheit.is_valid(); ++fheit)
{
vh = _m.to_vertex_handle(fheit);
if( (_m.valence(vh) != 6) && (!_m.is_boundary(vh)) )
{
unsigned int K = _m.valence(vh);
pos += weights_[K][K]*_m.point(vh);
heh = _m.opposite_halfedge_handle( fheit.handle() );
heh = _m.opposite_halfedge_handle( *fheit );
for(unsigned int i = 0; i<K; ++i, heh = _m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh)) )
{
pos += weights_[K][i]*_m.point(_m.to_vertex_handle(heh));
......@@ -364,7 +364,7 @@ protected:
}
vh = _m.add_vertex( pos );
_m.property(fp_pos_, fit.handle()) = vh;
_m.property(fp_pos_, *fit) = vh;
}
}
......@@ -377,8 +377,8 @@ protected:
}
else
{
assert(_m.property(fp_pos_, fit.handle()).is_valid());
_m.split( fit, _m.property(fp_pos_, fit.handle()) );
assert(_m.property(fp_pos_, *fit).is_valid());
_m.split( fit, _m.property(fp_pos_, *fit) );
}
}
......
......@@ -84,7 +84,7 @@ check(unsigned int _targets, std::ostream& _os)
{
if (!is_deleted(v_it))
{
vh = v_it.handle();
vh = *v_it;
/* The outgoing halfedge of a boundary vertex has to be a
......@@ -95,7 +95,7 @@ check(unsigned int _targets, std::ostream& _os)
for (typename Mesh::ConstVertexOHalfedgeIter vh_it(mesh_, vh);
vh_it; ++vh_it)
{
if (mesh_.is_boundary(vh_it.handle()))
if (mesh_.is_boundary(*vh_it))
{
_os << "MeshChecker: vertex " << vh
<< ": outgoing halfedge not on boundary error\n";
......@@ -150,9 +150,9 @@ check(unsigned int _targets, std::ostream& _os)
for (; h_it != h_end; ++h_it)
{
if (!is_deleted(mesh_.edge_handle(h_it.handle())))
if (!is_deleted(mesh_.edge_handle(*h_it)))
{
hh = h_it.handle();
hh = *h_it;
// degenerated halfedge ?
......@@ -206,11 +206,11 @@ check(unsigned int _targets, std::ostream& _os)
{
if (!is_deleted(f_it))
{
fh = f_it.handle();
fh = *f_it;
for (fh_it=mesh_.cfh_iter(fh); fh_it; ++fh_it)
{
if (mesh_.face_handle(fh_it.handle()) != fh)
if (mesh_.face_handle(*fh_it) != fh)
{
_os << "MeshChecker: face " << fh
<< ": its halfedge does not reference face\n";
......
......@@ -142,7 +142,7 @@ build_strips()
// collect starting halfedges
h[0] = mesh_.halfedge_handle(f_it.handle());
h[0] = mesh_.halfedge_handle(*f_it);
h[1] = mesh_.next_halfedge_handle(h[0]);
h[2] = mesh_.next_halfedge_handle(h[1]);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment