@@ -79,7 +79,8 @@ namespace geode
7979 }
8080
8181 std::vector< index_t > frame_neighbors ( const Point< dimension >& point,
82- const Frame< dimension >& epsilons_frame ) const
82+ const Frame< dimension >& epsilons_frame,
83+ const double factor_distance ) const
8384 {
8485 std::vector< nanoflann::ResultItem< index_t , double > > results;
8586 nanoflann::SearchParameters params;
@@ -88,7 +89,8 @@ namespace geode
8889 epsilons_frame.max_elongation_direction ();
8990 const auto max_elongation =
9091 epsilons_frame.direction ( max_elongation_direction ).length ();
91- const auto radius = max_elongation * max_elongation;
92+ const auto radius = factor_distance * factor_distance
93+ * max_elongation * max_elongation;
9294 const auto nb_results = nn_tree_.radiusSearch (
9395 © ( point )[0 ], radius, results, params );
9496 std::vector< index_t > indices;
@@ -191,12 +193,14 @@ namespace geode
191193 typename geode::NNSearch< dimension >::ColocatedInfo
192194 colocated_index_mapping (
193195 const geode::NNSearch< dimension >& nn_search,
194- const Frame< dimension >& epsilons_frame ) const
196+ const Frame< dimension >& epsilons_frame,
197+ const double factor_distance ) const
195198 {
196199 for ( const auto d : LRange{ dimension } )
197200 {
198201 OPENGEODE_EXCEPTION (
199- epsilons_frame.direction ( d ).length () >= GLOBAL_EPSILON,
202+ epsilons_frame.direction ( d ).length () * factor_distance
203+ >= GLOBAL_EPSILON,
200204 " [NNSearch::colocated_index_mapping] Given epsilon too "
201205 " small, "
202206 " should be bigger than GLOBAL_EPSILON (i.e. " ,
@@ -207,14 +211,15 @@ namespace geode
207211 std::vector< index_t > mapping ( nb_points, NO_ID );
208212 std::mutex mutex;
209213 async::parallel_for ( async::irange ( index_t { 0 }, nb_points ),
210- [&nn_search, &epsilons_frame, &mapping , &mutex, this ](
211- index_t point_id ) {
214+ [&nn_search, &epsilons_frame, &factor_distance , &mapping,
215+ &mutex, this ]( index_t point_id ) {
212216 if ( mapping[point_id] != NO_ID )
213217 {
214218 return ;
215219 }
216- const auto vertices_around = frame_neighbors (
217- nn_search.point ( point_id ), epsilons_frame );
220+ const auto vertices_around =
221+ frame_neighbors ( nn_search.point ( point_id ),
222+ epsilons_frame, factor_distance );
218223 std::lock_guard< std::mutex > lock ( mutex );
219224 if ( mapping[point_id] != NO_ID )
220225 {
@@ -352,9 +357,10 @@ namespace geode
352357 template < index_t dimension >
353358 std::vector< index_t > NNSearch< dimension >::frame_neighbors(
354359 const Point< dimension >& point,
355- const Frame< dimension >& epsilons_frame ) const
360+ const Frame< dimension >& epsilons_frame,
361+ const double factor_distance ) const
356362 {
357- return impl_->frame_neighbors ( point, epsilons_frame );
363+ return impl_->frame_neighbors ( point, epsilons_frame, factor_distance );
358364 }
359365
360366 template < index_t dimension >
@@ -375,9 +381,11 @@ namespace geode
375381 template < geode::index_t dimension >
376382 typename geode::NNSearch< dimension >::ColocatedInfo
377383 NNSearch< dimension >::colocated_index_mapping(
378- const Frame< dimension >& epsilons_frame ) const
384+ const Frame< dimension >& epsilons_frame,
385+ const double factor_distance ) const
379386 {
380- return impl_->colocated_index_mapping ( *this , epsilons_frame );
387+ return impl_->colocated_index_mapping (
388+ *this , epsilons_frame, factor_distance );
381389 }
382390
383391 template class opengeode_geometry_api NNSearch< 2 >;
0 commit comments