Finished except unittests
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@910 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -150,11 +150,11 @@ ProgViewerWidget::open_prog_mesh(const char* _filename)
|
|||||||
|
|
||||||
MyMesh::Point bbMin, bbMax;
|
MyMesh::Point bbMin, bbMax;
|
||||||
|
|
||||||
bbMin = bbMax = mesh_.point(vIt);
|
bbMin = bbMax = mesh_.point(*vIt);
|
||||||
for (; vIt!=vEnd; ++vIt)
|
for (; vIt!=vEnd; ++vIt)
|
||||||
{
|
{
|
||||||
bbMin.minimize(mesh_.point(vIt));
|
bbMin.minimize(mesh_.point(*vIt));
|
||||||
bbMax.maximize(mesh_.point(vIt));
|
bbMax.maximize(mesh_.point(*vIt));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set center and radius
|
// set center and radius
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
|
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
|
||||||
|
|
||||||
if (mesh.data(f_it).state() < target1) {
|
if (mesh.data(*f_it).state() < target1) {
|
||||||
++i;
|
++i;
|
||||||
fh = *f_it;
|
fh = *f_it;
|
||||||
timer2.start();
|
timer2.start();
|
||||||
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (v_it = mesh.vertices_begin(); v_it != mesh.vertices_end(); ++v_it) {
|
for (v_it = mesh.vertices_begin(); v_it != mesh.vertices_end(); ++v_it) {
|
||||||
|
|
||||||
if (mesh.data(v_it).state() < target2) {
|
if (mesh.data(*v_it).state() < target2) {
|
||||||
vh = *v_it;
|
vh = *v_it;
|
||||||
timer2.cont();
|
timer2.cont();
|
||||||
subdivider.refine(vh);
|
subdivider.refine(vh);
|
||||||
@@ -420,8 +420,8 @@ int main(int argc, char **argv)
|
|||||||
for (MyMesh::VertexIter v_it = mesh.vertices_begin();
|
for (MyMesh::VertexIter v_it = mesh.vertices_begin();
|
||||||
v_it != mesh.vertices_end(); ++v_it)
|
v_it != mesh.vertices_end(); ++v_it)
|
||||||
{
|
{
|
||||||
if (mesh.data(v_it).state() > max_level)
|
if (mesh.data(*v_it).state() > max_level)
|
||||||
max_level = mesh.data(v_it).state();
|
max_level = mesh.data(*v_it).state();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -430,11 +430,11 @@ open_prog_mesh(const std::string& _filename)
|
|||||||
|
|
||||||
Mesh::Point bbMin, bbMax;
|
Mesh::Point bbMin, bbMax;
|
||||||
|
|
||||||
bbMin = bbMax = mesh_.point(vIt);
|
bbMin = bbMax = mesh_.point(*vIt);
|
||||||
for (; vIt!=vEnd; ++vIt)
|
for (; vIt!=vEnd; ++vIt)
|
||||||
{
|
{
|
||||||
bbMin.minimize(mesh_.point(vIt));
|
bbMin.minimize(mesh_.point(*vIt));
|
||||||
bbMax.maximize(mesh_.point(vIt));
|
bbMax.maximize(mesh_.point(*vIt));
|
||||||
}
|
}
|
||||||
|
|
||||||
// info
|
// info
|
||||||
@@ -661,7 +661,7 @@ vdpm_analysis()
|
|||||||
for (h_it=mesh_.halfedges_begin(); h_it!=mesh_.halfedges_end(); ++h_it)
|
for (h_it=mesh_.halfedges_begin(); h_it!=mesh_.halfedges_end(); ++h_it)
|
||||||
{
|
{
|
||||||
vh = mesh_.to_vertex_handle(*h_it);
|
vh = mesh_.to_vertex_handle(*h_it);
|
||||||
mesh_.data(h_it).set_vhierarchy_leaf_node_handle(mesh_.data(vh).vhierarchy_node_handle());
|
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)
|
for (v_it=mesh_.vertices_begin(); v_it!=mesh_.vertices_end(); ++v_it)
|
||||||
|
|||||||
@@ -539,11 +539,11 @@ open_vd_prog_mesh(const char* _filename)
|
|||||||
|
|
||||||
VDPMMesh::Point bbMin, bbMax;
|
VDPMMesh::Point bbMin, bbMax;
|
||||||
|
|
||||||
bbMin = bbMax = mesh_.point(vIt);
|
bbMin = bbMax = mesh_.point(*vIt);
|
||||||
for (; vIt!=vEnd; ++vIt)
|
for (; vIt!=vEnd; ++vIt)
|
||||||
{
|
{
|
||||||
bbMin.minimize(mesh_.point(vIt));
|
bbMin.minimize(mesh_.point(*vIt));
|
||||||
bbMax.maximize(mesh_.point(vIt));
|
bbMax.maximize(mesh_.point(*vIt));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set center and radius
|
// set center and radius
|
||||||
|
|||||||
@@ -321,14 +321,14 @@ int main(int argc, char **argv)
|
|||||||
Mesh::FaceIter f_it;
|
Mesh::FaceIter f_it;
|
||||||
|
|
||||||
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it)
|
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it)
|
||||||
if ( !mesh.status(f_it).deleted() )
|
if ( !mesh.status(*f_it).deleted() )
|
||||||
mesh.update_normal(f_it);
|
mesh.update_normal(*f_it);
|
||||||
|
|
||||||
for (v_it = mesh.vertices_begin(); v_it != mesh.vertices_end(); ++v_it)
|
for (v_it = mesh.vertices_begin(); v_it != mesh.vertices_end(); ++v_it)
|
||||||
if ( !mesh.status(v_it).deleted() )
|
if ( !mesh.status(*v_it).deleted() )
|
||||||
{
|
{
|
||||||
mesh.status(v_it).set_locked(false);
|
mesh.status(*v_it).set_locked(false);
|
||||||
mesh.update_normal(v_it);
|
mesh.update_normal(*v_it);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ int main(int argc, char *argv[] )
|
|||||||
timer.start();
|
timer.start();
|
||||||
MyMesh::VertexIter vit = mesh.vertices_begin();
|
MyMesh::VertexIter vit = mesh.vertices_begin();
|
||||||
for (; vit != mesh.vertices_end(); ++vit)
|
for (; vit != mesh.vertices_end(); ++vit)
|
||||||
cog += mesh.point( vit );
|
cog += mesh.point( *vit );
|
||||||
timer.stop();
|
timer.stop();
|
||||||
nv = mesh.n_vertices();
|
nv = mesh.n_vertices();
|
||||||
cog *= 1.0f/mesh.n_vertices();
|
cog *= 1.0f/mesh.n_vertices();
|
||||||
@@ -303,7 +303,7 @@ int main(int argc, char *argv[] )
|
|||||||
vit = mesh.vertices_begin();
|
vit = mesh.vertices_begin();
|
||||||
timer.cont();
|
timer.cont();
|
||||||
for (; vit != mesh.vertices_end(); ++vit)
|
for (; vit != mesh.vertices_end(); ++vit)
|
||||||
mesh.set_point( vit , mesh.point( vit )-cog );
|
mesh.set_point( *vit , mesh.point( *vit )-cog );
|
||||||
timer.stop();
|
timer.stop();
|
||||||
nv += mesh.n_vertices();
|
nv += mesh.n_vertices();
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ int main(int argc, char *argv[] )
|
|||||||
timer.start();
|
timer.start();
|
||||||
MyMesh::VertexIter vit = mesh.vertices_begin();
|
MyMesh::VertexIter vit = mesh.vertices_begin();
|
||||||
for (; vit != mesh.vertices_end(); ++vit)
|
for (; vit != mesh.vertices_end(); ++vit)
|
||||||
mesh.set_point( vit , mesh.point( vit ) + tvec.first );
|
mesh.set_point( *vit , mesh.point( *vit ) + tvec.first );
|
||||||
timer.stop();
|
timer.stop();
|
||||||
std::cout << " moved " << mesh.n_vertices()
|
std::cout << " moved " << mesh.n_vertices()
|
||||||
<< " vertices in " << timer.as_string() << std::endl;
|
<< " vertices in " << timer.as_string() << std::endl;
|
||||||
@@ -342,9 +342,9 @@ int main(int argc, char *argv[] )
|
|||||||
MyMesh::VertexIter vit = mesh.vertices_begin();
|
MyMesh::VertexIter vit = mesh.vertices_begin();
|
||||||
for (; vit != mesh.vertices_end(); ++vit)
|
for (; vit != mesh.vertices_end(); ++vit)
|
||||||
{
|
{
|
||||||
mesh.set_color( vit , MyMesh::Color( std::min((int)(r+0.5),255),
|
mesh.set_color( *vit , MyMesh::Color( std::min((int)(r+0.5),255),
|
||||||
std::min((int)(g+0.5),255),
|
std::min((int)(g+0.5),255),
|
||||||
std::max((int)(b+0.5),0) ) );
|
std::max((int)(b+0.5),0) ) );
|
||||||
r += d;
|
r += d;
|
||||||
g += d2;
|
g += d2;
|
||||||
b -= d;
|
b -= d;
|
||||||
|
|||||||
@@ -97,11 +97,12 @@ void ModAspectRatioT<MeshT>::initialize() {
|
|||||||
typename Mesh::FVIter fv_it;
|
typename Mesh::FVIter fv_it;
|
||||||
|
|
||||||
for (f_it = mesh_.faces_begin(); f_it != f_end; ++f_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));
|
fv_it = mesh_.fv_iter(*f_it);
|
||||||
typename Mesh::Point& p1 = mesh_.point(++fv_it);
|
typename Mesh::Point& p0 = mesh_.point(*fv_it);
|
||||||
typename Mesh::Point& p2 = 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) {
|
for (typename Mesh::VFIter vf_it = mesh_.vf_iter(_ci.v0); vf_it.is_valid(); ++vf_it) {
|
||||||
fh = *vf_it;
|
fh = *vf_it;
|
||||||
if (fh != _ci.fl && fh != _ci.fr) {
|
if (fh != _ci.fl && fh != _ci.fr) {
|
||||||
typename Mesh::Point& p0 = mesh_.point(fv_it = mesh_.fv_iter(fh));
|
fv_it = mesh_.fv_iter(fh);
|
||||||
typename Mesh::Point& p1 = mesh_.point(++fv_it);
|
typename Mesh::Point& p0 = mesh_.point(*fv_it);
|
||||||
typename Mesh::Point& p2 = 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);
|
mesh_.property(aspect_, fh) = 1.0 / aspectRatio(p0, p1, p2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ initialize()
|
|||||||
typename Mesh::FIter f_it(mesh_.faces_begin()), f_end(mesh_.faces_end());
|
typename Mesh::FIter f_it(mesh_.faces_begin()), f_end(mesh_.faces_end());
|
||||||
|
|
||||||
for (; f_it!=f_end; ++f_it)
|
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;
|
ok = false;
|
||||||
|
|
||||||
for (fh_it=faces.begin(); !ok && fh_it!=fh_end; ++fh_it) {
|
for (fh_it=faces.begin(); !ok && fh_it!=fh_end; ++fh_it) {
|
||||||
const Point& p0 = mesh_.point(fv_it=mesh_.cfv_iter(*fh_it));
|
fv_it=mesh_.cfv_iter(*fh_it);
|
||||||
const Point& p1 = mesh_.point(++fv_it);
|
const Point& p0 = mesh_.point(*fv_it);
|
||||||
const Point& p2 = 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)
|
if ( distPointTriangleSquared(*p_it, p0, p1, p2) <= sqr_tolerace)
|
||||||
ok = true;
|
ok = true;
|
||||||
@@ -328,9 +329,10 @@ postprocess_collapse(const CollapseInfo& _ci)
|
|||||||
emin = FLT_MAX;
|
emin = FLT_MAX;
|
||||||
|
|
||||||
for (fh_it=faces.begin(); fh_it!=fh_end; ++fh_it) {
|
for (fh_it=faces.begin(); fh_it!=fh_end; ++fh_it) {
|
||||||
const Point& p0 = mesh_.point(fv_it=mesh_.cfv_iter(*fh_it));
|
fv_it=mesh_.cfv_iter(*fh_it);
|
||||||
const Point& p1 = mesh_.point(++fv_it);
|
const Point& p0 = mesh_.point(*fv_it);
|
||||||
const Point& p2 = 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);
|
e = distPointTriangleSquared(*p_it, p0, p1, p2);
|
||||||
if (e < emin) {
|
if (e < emin) {
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ public:
|
|||||||
f_end = mesh_.faces_end();
|
f_end = mesh_.faces_end();
|
||||||
|
|
||||||
for (; f_it != f_end; ++f_it)
|
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
|
/** \brief Control normals when Decimating
|
||||||
@@ -208,8 +208,8 @@ public:
|
|||||||
// account for changed normals
|
// account for changed normals
|
||||||
typename Mesh::VertexFaceIter vf_it(mesh_, _ci.v1);
|
typename Mesh::VertexFaceIter vf_it(mesh_, _ci.v1);
|
||||||
for (; vf_it.is_valid(); ++vf_it)
|
for (; vf_it.is_valid(); ++vf_it)
|
||||||
mesh_.property(normal_cones_, vf_it).
|
mesh_.property(normal_cones_, *vf_it).
|
||||||
merge(NormalCone(mesh_.normal(vf_it)));
|
merge(NormalCone(mesh_.normal(*vf_it)));
|
||||||
|
|
||||||
|
|
||||||
// normal cones of deleted triangles
|
// normal cones of deleted triangles
|
||||||
|
|||||||
@@ -90,10 +90,10 @@ write( const std::string& _ofname )
|
|||||||
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)
|
||||||
if (!Base::mesh().status(v_it).deleted())
|
if (!Base::mesh().status(*v_it).deleted())
|
||||||
{
|
{
|
||||||
vhandles[i] = *v_it;
|
vhandles[i] = *v_it;
|
||||||
Base::mesh().property( idx_, v_it ) = i;
|
Base::mesh().property( idx_, *v_it ) = i;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
n_base_vertices = i;
|
n_base_vertices = i;
|
||||||
@@ -115,7 +115,7 @@ write( const std::string& _ofname )
|
|||||||
typename Mesh::ConstFaceIter f_it = Base::mesh().faces_begin(),
|
typename Mesh::ConstFaceIter f_it = Base::mesh().faces_begin(),
|
||||||
f_end = Base::mesh().faces_end();
|
f_end = Base::mesh().faces_end();
|
||||||
for (; f_it != f_end; ++f_it)
|
for (; f_it != f_end; ++f_it)
|
||||||
if (!Base::mesh().status(f_it).deleted())
|
if (!Base::mesh().status(*f_it).deleted())
|
||||||
++n_base_faces;
|
++n_base_faces;
|
||||||
|
|
||||||
// ---------------------------------------- write progressive mesh
|
// ---------------------------------------- write progressive mesh
|
||||||
@@ -149,13 +149,13 @@ write( const std::string& _ofname )
|
|||||||
// write base faces
|
// write base faces
|
||||||
for (f_it=Base::mesh().faces_begin(); f_it != f_end; ++f_it)
|
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);
|
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 )) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,14 +127,14 @@ class ModRoundnessT : public ModBaseT<MeshT>
|
|||||||
|
|
||||||
if ( min_r_ < 0.0 ) // continues mode
|
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 );
|
fhC = Base::mesh().face_handle( *voh_it );
|
||||||
|
|
||||||
for (++voh_it; voh_it.is_valid(); ++voh_it)
|
for (++voh_it; voh_it.is_valid(); ++voh_it)
|
||||||
{
|
{
|
||||||
B = C;
|
B = C;
|
||||||
fhB = fhC;
|
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 );
|
fhC = Base::mesh().face_handle( *voh_it );
|
||||||
|
|
||||||
if ( fhB == _ci.fl || fhB == _ci.fr )
|
if ( fhB == _ci.fl || fhB == _ci.fr )
|
||||||
@@ -150,14 +150,14 @@ class ModRoundnessT : public ModBaseT<MeshT>
|
|||||||
}
|
}
|
||||||
else // binary mode
|
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 );
|
fhC = Base::mesh().face_handle( *voh_it );
|
||||||
|
|
||||||
for (++voh_it; voh_it.is_valid() && (priority==Base::LEGAL_COLLAPSE); ++voh_it)
|
for (++voh_it; voh_it.is_valid() && (priority==Base::LEGAL_COLLAPSE); ++voh_it)
|
||||||
{
|
{
|
||||||
B = C;
|
B = C;
|
||||||
fhB = fhC;
|
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 );
|
fhC = Base::mesh().face_handle( *voh_it );
|
||||||
|
|
||||||
if ( fhB == _ci.fl || fhB == _ci.fr )
|
if ( fhB == _ci.fl || fhB == _ci.fr )
|
||||||
|
|||||||
@@ -104,16 +104,16 @@ compute_new_positions_C0()
|
|||||||
|
|
||||||
for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
||||||
{
|
{
|
||||||
if (this->is_active(v_it))
|
if (this->is_active(*v_it))
|
||||||
{
|
{
|
||||||
// compute umbrella
|
// compute umbrella
|
||||||
u = zero;
|
u = zero;
|
||||||
for (vv_it=Base::mesh_.cvv_iter(v_it); vv_it.is_valid(); ++vv_it)
|
for (vv_it=Base::mesh_.cvv_iter(*v_it); vv_it.is_valid(); ++vv_it)
|
||||||
{
|
{
|
||||||
w = this->weight(Base::mesh_.edge_handle(vv_it.current_halfedge_handle()));
|
w = this->weight(Base::mesh_.edge_handle(vv_it.current_halfedge_handle()));
|
||||||
u += vector_cast<typename Mesh::Normal>(Base::mesh_.point(*vv_it)) * w;
|
u += vector_cast<typename Mesh::Normal>(Base::mesh_.point(*vv_it)) * w;
|
||||||
}
|
}
|
||||||
u *= this->weight(v_it);
|
u *= this->weight(*v_it);
|
||||||
u -= vector_cast<typename Mesh::Normal>(Base::mesh_.point(*v_it));
|
u -= vector_cast<typename Mesh::Normal>(Base::mesh_.point(*v_it));
|
||||||
|
|
||||||
// damping
|
// damping
|
||||||
@@ -146,43 +146,43 @@ compute_new_positions_C1()
|
|||||||
for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
||||||
{
|
{
|
||||||
u = zero;
|
u = zero;
|
||||||
for (vv_it=Base::mesh_.cvv_iter(v_it); vv_it.is_valid(); ++vv_it)
|
for (vv_it=Base::mesh_.cvv_iter(*v_it); vv_it.is_valid(); ++vv_it)
|
||||||
{
|
{
|
||||||
w = this->weight(Base::mesh_.edge_handle(vv_it.current_halfedge_handle()));
|
w = this->weight(Base::mesh_.edge_handle(vv_it.current_halfedge_handle()));
|
||||||
u -= vector_cast<typename Mesh::Normal>(Base::mesh_.point(*vv_it))*w;
|
u -= vector_cast<typename Mesh::Normal>(Base::mesh_.point(*vv_it))*w;
|
||||||
}
|
}
|
||||||
u *= this->weight(v_it);
|
u *= this->weight(*v_it);
|
||||||
u += vector_cast<typename Mesh::Normal>(Base::mesh_.point(v_it));
|
u += vector_cast<typename Mesh::Normal>(Base::mesh_.point(*v_it));
|
||||||
|
|
||||||
Base::mesh_.property(umbrellas_, v_it) = u;
|
Base::mesh_.property(umbrellas_, *v_it) = u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 2nd pass: compute updates
|
// 2nd pass: compute updates
|
||||||
for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
||||||
{
|
{
|
||||||
if (this->is_active(v_it))
|
if (this->is_active(*v_it))
|
||||||
{
|
{
|
||||||
uu = zero;
|
uu = zero;
|
||||||
diag = 0.0;
|
diag = 0.0;
|
||||||
for (vv_it=Base::mesh_.cvv_iter(v_it); vv_it.is_valid(); ++vv_it)
|
for (vv_it=Base::mesh_.cvv_iter(*v_it); vv_it.is_valid(); ++vv_it)
|
||||||
{
|
{
|
||||||
w = this->weight(Base::mesh_.edge_handle(vv_it.current_halfedge_handle()));
|
w = this->weight(Base::mesh_.edge_handle(vv_it.current_halfedge_handle()));
|
||||||
uu -= Base::mesh_.property(umbrellas_, *vv_it);
|
uu -= Base::mesh_.property(umbrellas_, *vv_it);
|
||||||
diag += (w * this->weight(*vv_it) + 1.0) * w;
|
diag += (w * this->weight(*vv_it) + 1.0) * w;
|
||||||
}
|
}
|
||||||
uu *= this->weight(v_it);
|
uu *= this->weight(*v_it);
|
||||||
diag *= this->weight(v_it);
|
diag *= this->weight(*v_it);
|
||||||
uu += Base::mesh_.property(umbrellas_, v_it);
|
uu += Base::mesh_.property(umbrellas_, *v_it);
|
||||||
if (diag) uu *= 1.0/diag;
|
if (diag) uu *= 1.0/diag;
|
||||||
|
|
||||||
// damping
|
// damping
|
||||||
uu *= 0.25;
|
uu *= 0.25;
|
||||||
|
|
||||||
// store new position
|
// store new position
|
||||||
p = vector_cast<typename Mesh::Normal>(Base::mesh_.point(v_it));
|
p = vector_cast<typename Mesh::Normal>(Base::mesh_.point(*v_it));
|
||||||
p -= uu;
|
p -= uu;
|
||||||
this->set_new_position(v_it, p);
|
this->set_new_position(*v_it, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ compute_weights(LaplaceWeighting _weighting)
|
|||||||
|
|
||||||
// init vertex weights
|
// init vertex weights
|
||||||
for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
||||||
Base::mesh_.property(vertex_weights_, v_it) = 0.0;
|
Base::mesh_.property(vertex_weights_, *v_it) = 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -156,9 +156,9 @@ compute_weights(LaplaceWeighting _weighting)
|
|||||||
v0 = Base::mesh_.to_vertex_handle(heh0);
|
v0 = Base::mesh_.to_vertex_handle(heh0);
|
||||||
v1 = Base::mesh_.to_vertex_handle(heh1);
|
v1 = Base::mesh_.to_vertex_handle(heh1);
|
||||||
|
|
||||||
Base::mesh_.property(edge_weights_, e_it) = 1.0;
|
Base::mesh_.property(edge_weights_, *e_it) = 1.0;
|
||||||
Base::mesh_.property(vertex_weights_, v0) += 1.0;
|
Base::mesh_.property(vertex_weights_, v0) += 1.0;
|
||||||
Base::mesh_.property(vertex_weights_, v1) += 1.0;
|
Base::mesh_.property(vertex_weights_, v1) += 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -135,8 +135,8 @@ initialize(Component _comp, Continuity _cont)
|
|||||||
// store original points & normals
|
// store original points & normals
|
||||||
for (v_it=mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
for (v_it=mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
||||||
{
|
{
|
||||||
mesh_.property(original_positions_, v_it) = mesh_.point(v_it);
|
mesh_.property(original_positions_, *v_it) = mesh_.point(*v_it);
|
||||||
mesh_.property(original_normals_, v_it) = mesh_.normal(v_it);
|
mesh_.property(original_normals_, *v_it) = mesh_.normal(*v_it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ set_active_vertices()
|
|||||||
// is something selected?
|
// is something selected?
|
||||||
bool nothing_selected(true);
|
bool nothing_selected(true);
|
||||||
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_.status(v_it).selected())
|
if (mesh_.status(*v_it).selected())
|
||||||
{ nothing_selected = false; break; }
|
{ nothing_selected = false; break; }
|
||||||
|
|
||||||
|
|
||||||
@@ -163,15 +163,15 @@ set_active_vertices()
|
|||||||
bool active;
|
bool active;
|
||||||
for (v_it=mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
for (v_it=mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
||||||
{
|
{
|
||||||
active = ((nothing_selected || mesh_.status(v_it).selected())
|
active = ((nothing_selected || mesh_.status(*v_it).selected())
|
||||||
&& !mesh_.is_boundary(v_it)
|
&& !mesh_.is_boundary(*v_it)
|
||||||
&& !mesh_.status(v_it).locked());
|
&& !mesh_.status(*v_it).locked());
|
||||||
|
|
||||||
if ( skip_features_ ) {
|
if ( skip_features_ ) {
|
||||||
|
|
||||||
active = active && !mesh_.status(v_it).feature();
|
active = active && !mesh_.status(*v_it).feature();
|
||||||
|
|
||||||
typename Mesh::VertexOHalfedgeIter voh_it(mesh_,v_it);
|
typename Mesh::VertexOHalfedgeIter voh_it(mesh_,*v_it);
|
||||||
for ( ; voh_it.is_valid() ; ++voh_it ) {
|
for ( ; voh_it.is_valid() ; ++voh_it ) {
|
||||||
|
|
||||||
// If the edge is a feature edge, skip the current vertex while smoothing
|
// If the edge is a feature edge, skip the current vertex while smoothing
|
||||||
@@ -190,7 +190,7 @@ set_active_vertices()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh_.property(is_active_, v_it) = active;
|
mesh_.property(is_active_, *v_it) = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ set_active_vertices()
|
|||||||
typename Mesh::VVIter vv_it;
|
typename Mesh::VVIter vv_it;
|
||||||
|
|
||||||
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))
|
if (mesh_.is_boundary(*v_it))
|
||||||
for (vv_it=mesh_.vv_iter(*v_it); vv_it.is_valid(); ++vv_it)
|
for (vv_it=mesh_.vv_iter(*v_it); vv_it.is_valid(); ++vv_it)
|
||||||
mesh_.property(is_active_, *vv_it) = false;
|
mesh_.property(is_active_, *vv_it) = false;
|
||||||
}
|
}
|
||||||
@@ -360,14 +360,14 @@ project_to_tangent_plane()
|
|||||||
|
|
||||||
for (; v_it != v_end; ++v_it)
|
for (; v_it != v_end; ++v_it)
|
||||||
{
|
{
|
||||||
if (is_active(v_it))
|
if (is_active(*v_it))
|
||||||
{
|
{
|
||||||
translation = new_position(v_it)-orig_position(v_it);
|
translation = new_position(*v_it)-orig_position(*v_it);
|
||||||
normal = orig_normal(v_it);
|
normal = orig_normal(*v_it);
|
||||||
normal *= dot(translation, normal);
|
normal *= dot(translation, normal);
|
||||||
translation -= normal;
|
translation -= normal;
|
||||||
translation += vector_cast<typename Mesh::Normal>(orig_position(v_it));
|
translation += vector_cast<typename Mesh::Normal>(orig_position(*v_it));
|
||||||
set_new_position(v_it, translation);
|
set_new_position(*v_it, translation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,17 +390,17 @@ local_error_check()
|
|||||||
|
|
||||||
for (; v_it != v_end; ++v_it)
|
for (; v_it != v_end; ++v_it)
|
||||||
{
|
{
|
||||||
if (is_active(v_it))
|
if (is_active(*v_it))
|
||||||
{
|
{
|
||||||
translation = new_position(v_it) - orig_position(v_it);
|
translation = new_position(*v_it) - orig_position(*v_it);
|
||||||
|
|
||||||
s = fabs(dot(translation, orig_normal(v_it)));
|
s = fabs(dot(translation, orig_normal(*v_it)));
|
||||||
|
|
||||||
if (s > tolerance_)
|
if (s > tolerance_)
|
||||||
{
|
{
|
||||||
translation *= (tolerance_ / s);
|
translation *= (tolerance_ / s);
|
||||||
translation += vector_cast<NormalType>(orig_position(v_it));
|
translation += vector_cast<NormalType>(orig_position(*v_it));
|
||||||
set_new_position(v_it, translation);
|
set_new_position(*v_it, translation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,8 +419,8 @@ move_points()
|
|||||||
v_end(mesh_.vertices_end());
|
v_end(mesh_.vertices_end());
|
||||||
|
|
||||||
for (; v_it != v_end; ++v_it)
|
for (; v_it != v_end; ++v_it)
|
||||||
if (is_active(v_it))
|
if (is_active(*v_it))
|
||||||
mesh_.set_point(v_it, mesh_.property(new_positions_, v_it));
|
mesh_.set_point(*v_it, mesh_.property(new_positions_, *v_it));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -83,25 +83,25 @@ initialize( void )
|
|||||||
// ---------------------------------------- Init Vertices
|
// ---------------------------------------- Init Vertices
|
||||||
for (v_it = mesh_.vertices_begin(); v_it != mesh_.vertices_end(); ++v_it)
|
for (v_it = mesh_.vertices_begin(); v_it != mesh_.vertices_end(); ++v_it)
|
||||||
{
|
{
|
||||||
mesh_.data(v_it).set_state(0);
|
mesh_.data(*v_it).set_state(0);
|
||||||
mesh_.data(v_it).set_final();
|
mesh_.data(*v_it).set_final();
|
||||||
mesh_.data(v_it).set_position(0, mesh_.point(*v_it));
|
mesh_.data(*v_it).set_position(0, mesh_.point(*v_it));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------- Init Faces
|
// ---------------------------------------- Init Faces
|
||||||
for (f_it = mesh_.faces_begin(); f_it != mesh_.faces_end(); ++f_it)
|
for (f_it = mesh_.faces_begin(); f_it != mesh_.faces_end(); ++f_it)
|
||||||
{
|
{
|
||||||
mesh_.data(f_it).set_state(0);
|
mesh_.data(*f_it).set_state(0);
|
||||||
mesh_.data(f_it).set_final();
|
mesh_.data(*f_it).set_final();
|
||||||
mesh_.data(f_it).set_position(0, zero_point);
|
mesh_.data(*f_it).set_position(0, zero_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------- Init Edges
|
// ---------------------------------------- Init Edges
|
||||||
for (e_it = mesh_.edges_begin(); e_it != mesh_.edges_end(); ++e_it)
|
for (e_it = mesh_.edges_begin(); e_it != mesh_.edges_end(); ++e_it)
|
||||||
{
|
{
|
||||||
mesh_.data(e_it).set_state(0);
|
mesh_.data(*e_it).set_state(0);
|
||||||
mesh_.data(e_it).set_final();
|
mesh_.data(*e_it).set_final();
|
||||||
mesh_.data(e_it).set_position(0, zero_point);
|
mesh_.data(*e_it).set_position(0, zero_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -845,7 +845,7 @@ void VF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
|
|||||||
for (fv_it = Base::mesh_.fv_iter(_fh); fv_it.is_valid(); ++fv_it) {
|
for (fv_it = Base::mesh_.fv_iter(_fh); fv_it.is_valid(); ++fv_it) {
|
||||||
|
|
||||||
++valence;
|
++valence;
|
||||||
position += Base::mesh_.data(fv_it).position(_target_state - 1);
|
position += Base::mesh_.data(*fv_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
position /= valence;
|
position /= valence;
|
||||||
@@ -917,7 +917,7 @@ void FF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state) {
|
|||||||
|
|
||||||
++valence;
|
++valence;
|
||||||
|
|
||||||
position += Base::mesh_.data(ff_it).position(_target_state - 1);
|
position += Base::mesh_.data(*ff_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
position /= valence;
|
position /= valence;
|
||||||
@@ -975,7 +975,7 @@ void FFc<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
|
|||||||
for (ff_it = Base::mesh_.ff_iter(_fh); ff_it.is_valid(); ++ff_it)
|
for (ff_it = Base::mesh_.ff_iter(_fh); ff_it.is_valid(); ++ff_it)
|
||||||
{
|
{
|
||||||
++valence;
|
++valence;
|
||||||
position += Base::mesh_.data(ff_it).position(_target_state - 1);
|
position += Base::mesh_.data(*ff_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
position /= valence;
|
position /= valence;
|
||||||
@@ -1045,7 +1045,7 @@ void FV<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
|
|||||||
for (vf_it = Base::mesh_.vf_iter(_vh); vf_it.is_valid(); ++vf_it) {
|
for (vf_it = Base::mesh_.vf_iter(_vh); vf_it.is_valid(); ++vf_it) {
|
||||||
|
|
||||||
++valence;
|
++valence;
|
||||||
position += Base::mesh_.data(vf_it).position(_target_state - 1);
|
position += Base::mesh_.data(*vf_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
position /= valence;
|
position /= valence;
|
||||||
@@ -1289,7 +1289,7 @@ void VV<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
|
|||||||
|
|
||||||
++valence;
|
++valence;
|
||||||
|
|
||||||
position += Base::mesh_.data(vv_it).position(_target_state - 1);
|
position += Base::mesh_.data(*vv_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
position /= valence;
|
position /= valence;
|
||||||
@@ -1359,7 +1359,7 @@ void VVc<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
|
|||||||
for (vv_it = Base::mesh_.vv_iter(_vh); vv_it.is_valid(); ++vv_it)
|
for (vv_it = Base::mesh_.vv_iter(_vh); vv_it.is_valid(); ++vv_it)
|
||||||
{
|
{
|
||||||
++valence;
|
++valence;
|
||||||
position += Base::mesh_.data(vv_it).position(_target_state - 1);
|
position += Base::mesh_.data(*vv_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
position /= valence;
|
position /= valence;
|
||||||
@@ -1627,11 +1627,11 @@ void EV<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
|
|||||||
|
|
||||||
for (ve_it = Base::mesh_.ve_iter(_vh); ve_it.is_valid(); ++ve_it) {
|
for (ve_it = Base::mesh_.ve_iter(_vh); ve_it.is_valid(); ++ve_it) {
|
||||||
|
|
||||||
if (Base::mesh_.data(ve_it).final()) {
|
if (Base::mesh_.data(*ve_it).final()) {
|
||||||
|
|
||||||
++valence;
|
++valence;
|
||||||
|
|
||||||
position += Base::mesh_.data(ve_it).position(_target_state - 1);
|
position += Base::mesh_.data(*ve_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1825,11 +1825,11 @@ EF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state) {
|
|||||||
|
|
||||||
for (fe_it = Base::mesh_.fe_iter(_fh); fe_it.is_valid(); ++fe_it) {
|
for (fe_it = Base::mesh_.fe_iter(_fh); fe_it.is_valid(); ++fe_it) {
|
||||||
|
|
||||||
if (Base::mesh_.data(fe_it).final()) {
|
if (Base::mesh_.data(*fe_it).final()) {
|
||||||
|
|
||||||
++valence;
|
++valence;
|
||||||
|
|
||||||
position += Base::mesh_.data(fe_it).position(_target_state - 1);
|
position += Base::mesh_.data(*fe_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user