diff --git a/Mesh/BDS.cpp b/Mesh/BDS.cpp index 6834ee34bde9f5f23bb55a6d9492bd96cb251efa..25f2a5b366ed18e6079d44480bcba6a64380566f 100644 --- a/Mesh/BDS.cpp +++ b/Mesh/BDS.cpp @@ -204,11 +204,12 @@ double dist_droites_gauches(BDS_Point *p1, BDS_Point *p2, } bool proj_point_triangle ( double xa, double ya, double za, + const BDS_Vector &n, BDS_Triangle *t, double &x, double &y, double &z) { const double eps_prec = 1.e-10; - BDS_Vector n = t->N(); + // BDS_Vector n = t->N(); double mat[3][3]; double b[3]; double res[2]; @@ -681,7 +682,7 @@ void BDS_Mesh :: createSearchStructures ( ) printf("creating the ANN search structure\n"); - const double LC_SEARCH = LC *3.e-3; + const double LC_SEARCH = LC *1.e-3; for (std::set<BDS_GeomEntity*,GeomLessThan>::iterator it = geom.begin(); it != geom.end(); @@ -2079,7 +2080,7 @@ bool project_point_on_a_list_of_triangles ( BDS_Point *p , { { double xp,yp,zp; - bool ok = proj_point_triangle ( p->X,p->Y,p->Z,*it,xp,yp,zp); + bool ok = proj_point_triangle ( p->X,p->Y,p->Z,p->N(),*it,xp,yp,zp); if (ok) { global_ok = true; @@ -2208,14 +2209,14 @@ void BDS_Mesh :: compute_metric_edge_lengths (const BDS_Metric & metric) 0.5*(e->p1->Y+e->p2->Y), 0.5*(e->p1->Z+e->p2->Z)); double radius = 1./curvature; - double target = 3.14159 *radius / 3.0; + double target = 3.14159 *radius / metric.nb_elements_per_radius_of_curvature; e->target_length = metric.update_target_length (target,e->target_length); // printf("e1 radius %g target %g length %g mlp %g ml %g\n",radius, target,e->length(),e->length()/target,e->metric_length); } else { double radius = 0.5*(e->p1->radius_of_curvature+e->p2->radius_of_curvature); - double target = 3.14159 * radius / 3.0; + double target = 3.14159 * radius / metric.nb_elements_per_radius_of_curvature; e->target_length = metric.update_target_length (target,e->target_length); } @@ -2263,7 +2264,7 @@ int BDS_Mesh :: adapt_mesh ( double l, bool smooth, BDS_Mesh *geom_mesh) SNAP_SUCCESS = 0; SNAP_FAILURE = 0; - BDS_Metric metric ( l , LC/200 , LC ); + BDS_Metric metric ( l , LC/500 , LC, 3 ); // printf("METRIC %g %g %g\n",LC,metric._min,metric._max); // add initial set of edges in a list @@ -2402,7 +2403,7 @@ int BDS_Mesh :: adapt_mesh ( double l, bool smooth, BDS_Mesh *geom_mesh) std::set<BDS_Point*, PointLessThan>::iterator ite = points.end(); while (it != ite) { - smooth_point(*it,geom_mesh); + smooth_point(*it,geom_mesh); ++it; } } diff --git a/Mesh/BDS.h b/Mesh/BDS.h index dae0541d3e5dcff1d90375cc8cd2dfc4210809d1..f217f688f0ce8e968fc55f38fd079d8e3bf5c975 100644 --- a/Mesh/BDS.h +++ b/Mesh/BDS.h @@ -29,8 +29,9 @@ class BDS_Metric { public: const double target,_min,_max,treshold; - BDS_Metric ( double _target , double _mmin, double _mmax, double _tres = 0.7) - : target(_target),_min(_mmin),_max(_mmax),treshold(_tres) + const double nb_elements_per_radius_of_curvature; + BDS_Metric ( double _target , double _mmin, double _mmax, double cc, double _tres = 0.7) + : target(_target),_min(_mmin),_max(_mmax), treshold(_tres),nb_elements_per_radius_of_curvature(cc) {} inline double update_target_length( double _target, double old_target_length ) const { diff --git a/Mesh/DiscreteSurface.cpp b/Mesh/DiscreteSurface.cpp index 0f2ef6f65cab133157f190103b28f34df0f43f3f..87b877b3786d244e1fa15c0fb15fa850eab12b18 100644 --- a/Mesh/DiscreteSurface.cpp +++ b/Mesh/DiscreteSurface.cpp @@ -1,4 +1,4 @@ -// $Id: DiscreteSurface.cpp,v 1.22 2005-08-24 14:32:56 remacle Exp $ +// $Id: DiscreteSurface.cpp,v 1.23 2005-08-25 14:56:54 remacle Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -50,11 +50,6 @@ void Mesh_To_BDS(Surface *s, BDS_Mesh *m) Vertex *v1 = simp->V[0]; Vertex *v2 = simp->V[1]; Vertex *v3 = simp->V[2]; - double n[3]; - normal3points ( v1->Pos.X , v1->Pos.Y , v1->Pos.Z, - v2->Pos.X , v2->Pos.Y , v2->Pos.Z, - v3->Pos.X , v3->Pos.Y , v3->Pos.Z, - n); m->add_triangle (v1->Num,v2->Num,v3->Num); } List_Delete (triangles);