Finished except unittests

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@910 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2013-08-07 12:24:09 +00:00
parent e30da7ea10
commit 959d80bb07
16 changed files with 117 additions and 113 deletions

View File

@@ -97,11 +97,12 @@ void ModAspectRatioT<MeshT>::initialize() {
typename Mesh::FVIter fv_it;
for (f_it = mesh_.faces_begin(); f_it != f_end; ++f_it) {
typename Mesh::Point& p0 = mesh_.point(fv_it = mesh_.fv_iter(f_it));
typename Mesh::Point& p1 = mesh_.point(++fv_it);
typename Mesh::Point& p2 = mesh_.point(++fv_it);
fv_it = mesh_.fv_iter(*f_it);
typename Mesh::Point& p0 = mesh_.point(*fv_it);
typename Mesh::Point& p1 = mesh_.point(*(++fv_it));
typename Mesh::Point& p2 = mesh_.point(*(++fv_it));
mesh_.property(aspect_, f_it) = 1.0 / aspectRatio(p0, p1, p2);
mesh_.property(aspect_, *f_it) = 1.0 / aspectRatio(p0, p1, p2);
}
}
@@ -115,9 +116,10 @@ void ModAspectRatioT<MeshT>::preprocess_collapse(const CollapseInfo& _ci) {
for (typename Mesh::VFIter vf_it = mesh_.vf_iter(_ci.v0); vf_it.is_valid(); ++vf_it) {
fh = *vf_it;
if (fh != _ci.fl && fh != _ci.fr) {
typename Mesh::Point& p0 = mesh_.point(fv_it = mesh_.fv_iter(fh));
typename Mesh::Point& p1 = mesh_.point(++fv_it);
typename Mesh::Point& p2 = mesh_.point(++fv_it);
fv_it = mesh_.fv_iter(fh);
typename Mesh::Point& p0 = mesh_.point(*fv_it);
typename Mesh::Point& p1 = mesh_.point(*(++fv_it));
typename Mesh::Point& p2 = mesh_.point(*(++fv_it));
mesh_.property(aspect_, fh) = 1.0 / aspectRatio(p0, p1, p2);
}

View File

@@ -191,7 +191,7 @@ initialize()
typename Mesh::FIter f_it(mesh_.faces_begin()), f_end(mesh_.faces_end());
for (; f_it!=f_end; ++f_it)
mesh_.property(points_, f_it).clear();
mesh_.property(points_, *f_it).clear();
}
@@ -242,9 +242,10 @@ collapse_priority(const CollapseInfo& _ci)
ok = false;
for (fh_it=faces.begin(); !ok && fh_it!=fh_end; ++fh_it) {
const Point& p0 = mesh_.point(fv_it=mesh_.cfv_iter(*fh_it));
const Point& p1 = mesh_.point(++fv_it);
const Point& p2 = mesh_.point(++fv_it);
fv_it=mesh_.cfv_iter(*fh_it);
const Point& p0 = mesh_.point(*fv_it);
const Point& p1 = mesh_.point(*(++fv_it));
const Point& p2 = mesh_.point(*(++fv_it));
if ( distPointTriangleSquared(*p_it, p0, p1, p2) <= sqr_tolerace)
ok = true;
@@ -328,9 +329,10 @@ postprocess_collapse(const CollapseInfo& _ci)
emin = FLT_MAX;
for (fh_it=faces.begin(); fh_it!=fh_end; ++fh_it) {
const Point& p0 = mesh_.point(fv_it=mesh_.cfv_iter(*fh_it));
const Point& p1 = mesh_.point(++fv_it);
const Point& p2 = mesh_.point(++fv_it);
fv_it=mesh_.cfv_iter(*fh_it);
const Point& p0 = mesh_.point(*fv_it);
const Point& p1 = mesh_.point(*(++fv_it));
const Point& p2 = mesh_.point(*(++fv_it));
e = distPointTriangleSquared(*p_it, p0, p1, p2);
if (e < emin) {

View File

@@ -137,7 +137,7 @@ public:
f_end = mesh_.faces_end();
for (; f_it != f_end; ++f_it)
mesh_.property(normal_cones_, f_it) = NormalCone(mesh_.normal(f_it));
mesh_.property(normal_cones_, *f_it) = NormalCone(mesh_.normal(*f_it));
}
/** \brief Control normals when Decimating
@@ -208,8 +208,8 @@ public:
// account for changed normals
typename Mesh::VertexFaceIter vf_it(mesh_, _ci.v1);
for (; vf_it.is_valid(); ++vf_it)
mesh_.property(normal_cones_, vf_it).
merge(NormalCone(mesh_.normal(vf_it)));
mesh_.property(normal_cones_, *vf_it).
merge(NormalCone(mesh_.normal(*vf_it)));
// normal cones of deleted triangles

View File

@@ -90,10 +90,10 @@ write( const std::string& _ofname )
v_end=Base::mesh().vertices_end();
for (; v_it != v_end; ++v_it)
if (!Base::mesh().status(v_it).deleted())
if (!Base::mesh().status(*v_it).deleted())
{
vhandles[i] = *v_it;
Base::mesh().property( idx_, v_it ) = i;
Base::mesh().property( idx_, *v_it ) = i;
++i;
}
n_base_vertices = i;
@@ -115,7 +115,7 @@ write( const std::string& _ofname )
typename Mesh::ConstFaceIter f_it = Base::mesh().faces_begin(),
f_end = Base::mesh().faces_end();
for (; f_it != f_end; ++f_it)
if (!Base::mesh().status(f_it).deleted())
if (!Base::mesh().status(*f_it).deleted())
++n_base_faces;
// ---------------------------------------- write progressive mesh
@@ -149,13 +149,13 @@ write( const std::string& _ofname )
// write base faces
for (f_it=Base::mesh().faces_begin(); f_it != f_end; ++f_it)
{
if (!Base::mesh().status(f_it).deleted())
if (!Base::mesh().status(*f_it).deleted())
{
typename Mesh::ConstFaceVertexIter fv_it(Base::mesh(), *f_it);
IO::store( out, Base::mesh().property( idx_, fv_it ) );
IO::store( out, Base::mesh().property( idx_, ++fv_it ) );
IO::store( out, Base::mesh().property( idx_, ++fv_it ) );
IO::store( out, Base::mesh().property( idx_, *fv_it ) );
IO::store( out, Base::mesh().property( idx_, *(++fv_it )) );
IO::store( out, Base::mesh().property( idx_, *(++fv_it )) );
}
}

View File

@@ -127,14 +127,14 @@ class ModRoundnessT : public ModBaseT<MeshT>
if ( min_r_ < 0.0 ) // continues mode
{
C = vector_cast<Vec3f>(Base::mesh().point( Base::mesh().to_vertex_handle(voh_it)));
C = vector_cast<Vec3f>(Base::mesh().point( Base::mesh().to_vertex_handle(*voh_it)));
fhC = Base::mesh().face_handle( *voh_it );
for (++voh_it; voh_it.is_valid(); ++voh_it)
{
B = C;
fhB = fhC;
C = vector_cast<Vec3f>(Base::mesh().point(Base::mesh().to_vertex_handle(voh_it)));
C = vector_cast<Vec3f>(Base::mesh().point(Base::mesh().to_vertex_handle(*voh_it)));
fhC = Base::mesh().face_handle( *voh_it );
if ( fhB == _ci.fl || fhB == _ci.fr )
@@ -150,14 +150,14 @@ class ModRoundnessT : public ModBaseT<MeshT>
}
else // binary mode
{
C = vector_cast<Vec3f>(Base::mesh().point( Base::mesh().to_vertex_handle(voh_it)));
C = vector_cast<Vec3f>(Base::mesh().point( Base::mesh().to_vertex_handle(*voh_it)));
fhC = Base::mesh().face_handle( *voh_it );
for (++voh_it; voh_it.is_valid() && (priority==Base::LEGAL_COLLAPSE); ++voh_it)
{
B = C;
fhB = fhC;
C = vector_cast<Vec3f>(Base::mesh().point(Base::mesh().to_vertex_handle(voh_it)));
C = vector_cast<Vec3f>(Base::mesh().point(Base::mesh().to_vertex_handle(*voh_it)));
fhC = Base::mesh().face_handle( *voh_it );
if ( fhB == _ci.fl || fhB == _ci.fr )