area smoothing tolerance fix

This commit is contained in:
konstantinos katrioplas
2018-03-26 14:12:42 +02:00
parent 45063e1346
commit 2ca3d01e35
4 changed files with 34 additions and 46 deletions
@@ -165,14 +165,14 @@ public:
#endif
}
void area_relaxation(const double& precision)
void area_relaxation(const double& tolerance)
{
std::size_t moved_points = 0;
BOOST_FOREACH(vertex_descriptor v, vrange_)
{
if(!is_border(v, mesh_) && !is_constrained(v))
{
if (gradient_descent(v, precision))
if (gradient_descent(v, tolerance))
moved_points++;
}
}
@@ -465,7 +465,7 @@ private:
// gradient descent
// ----------------
bool gradient_descent(const vertex_descriptor& v, const double& precision)
bool gradient_descent(const vertex_descriptor& v, const double& tolerance)
{
bool move_flag;
double x, y, z, x_new, y_new, z_new, drdx, drdy, drdz;
@@ -481,14 +481,14 @@ private:
return false;
double energy_new = 0;
double relative_energy = precision + 1;
double relative_energy = 1;
unsigned int t = 1;
double eta0 = 0.01;
//double power_t = 0.25;
double t0 = 0.001;
double eta = eta0 / (1 + t0*t);
while(relative_energy > precision)
while(relative_energy > tolerance)
{
drdx=0, drdy=0, drdz=0;
compute_derivatives(drdx, drdy, drdz, v, S_av);
@@ -364,7 +364,7 @@ void area_smoothing(PolygonMesh& pmesh, const FaceRange& faces, const NamedParam
unsigned int nb_iterations = choose_param(get_param(np, internal_np::number_of_iterations), 1);
//gradient descent precision
double gd_precision = choose_param(get_param(np, internal_np::gradient_descent_precision), 0.001);
double gd_precision = choose_param(get_param(np, internal_np::gradient_descent_precision), 0.000001);
internal::Compatible_remesher<PolygonMesh, VertexPointMap, VCMap, ECMap, GeomTraits>
remesher(pmesh, vpmap, vcmap, ecmap);