Finished except unittests
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@910 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -104,16 +104,16 @@ compute_new_positions_C0()
|
||||
|
||||
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
|
||||
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()));
|
||||
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));
|
||||
|
||||
// damping
|
||||
@@ -146,43 +146,43 @@ compute_new_positions_C1()
|
||||
for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
||||
{
|
||||
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()));
|
||||
u -= vector_cast<typename Mesh::Normal>(Base::mesh_.point(*vv_it))*w;
|
||||
}
|
||||
u *= this->weight(v_it);
|
||||
u += vector_cast<typename Mesh::Normal>(Base::mesh_.point(v_it));
|
||||
u *= this->weight(*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
|
||||
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;
|
||||
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()));
|
||||
uu -= Base::mesh_.property(umbrellas_, *vv_it);
|
||||
diag += (w * this->weight(*vv_it) + 1.0) * w;
|
||||
}
|
||||
uu *= this->weight(v_it);
|
||||
diag *= this->weight(v_it);
|
||||
uu += Base::mesh_.property(umbrellas_, v_it);
|
||||
uu *= this->weight(*v_it);
|
||||
diag *= this->weight(*v_it);
|
||||
uu += Base::mesh_.property(umbrellas_, *v_it);
|
||||
if (diag) uu *= 1.0/diag;
|
||||
|
||||
// damping
|
||||
uu *= 0.25;
|
||||
|
||||
// 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;
|
||||
this->set_new_position(v_it, p);
|
||||
this->set_new_position(*v_it, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user