From 6dc6920a148c52cb3736c0366e5f80838ee3b050 Mon Sep 17 00:00:00 2001 From: Antoine Lavenant Date: Thu, 3 Oct 2024 11:25:40 +0200 Subject: [PATCH] update test --- .../RadiusAssignFilter.cpp | 4 +-- test/test_radius_assign.py | 28 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/filter_radius_assign/RadiusAssignFilter.cpp b/src/filter_radius_assign/RadiusAssignFilter.cpp index 1fabd9c..d97b844 100644 --- a/src/filter_radius_assign/RadiusAssignFilter.cpp +++ b/src/filter_radius_assign/RadiusAssignFilter.cpp @@ -87,8 +87,8 @@ void RadiusAssignFilter::doOneNoDomain(PointRef &point) for (PointId ptId : iNeighbors) { double Zpt = refView->point(ptId).getFieldAs(Dimension::Id::Z); - if (m_args->m_max2d_below>=0 && Zrefm_max2d_below) {take=false; break;} - if (m_args->m_max2d_above>=0 && Zref>Zpt && (Zpt-Zref)m_max2d_above) {take=false; break;} + if (m_args->m_max2d_below>=0 && Zrefm_args->m_max2d_below) {take=false; break;} + if (m_args->m_max2d_above>=0 && Zref>Zpt && (Zpt-Zref)>m_args->m_max2d_above) {take=false; break;} } if (!take) return; } diff --git a/test/test_radius_assign.py b/test/test_radius_assign.py index 3ca94c3..9efa9ac 100755 --- a/test/test_radius_assign.py +++ b/test/test_radius_assign.py @@ -103,8 +103,6 @@ def build_random_points_around_one_point(test_function, distance_radius): if abs(distance3d(pt_i, pt_ini) - distance_radius) < 1 / numeric_precision: continue - print("pt_i", pt_i) - arrays_pti = np.array([pt_i], dtype=dtype) arrays_las = np.concatenate((arrays_las, arrays_pti), axis=0) @@ -164,20 +162,24 @@ def test_radius_assign_2d_cylinder(limit_z_above, limit_z_below): distance_radius = 1 - print("pt_ini", pt_ini) - def func_test(pt): distance_i = distance2d(pt_ini, pt) if distance_i < distance_radius: - if (limit_z_above >= 0) and ((pt[2] - pt_ini[2]) <= limit_z_above): - print("above", pt[2], pt_ini[2], pt[2] - pt_ini[2], limit_z_above) - return 1 - if (limit_z_below >= 0) and ((pt_ini[2] - pt[2]) <= limit_z_below): - print("below", pt[2], pt_ini[2], pt_ini[2] - pt[2], limit_z_below) - return 1 - if limit_z_above < 0 and limit_z_below < 0: - return 1 - return 0 + if ( + (limit_z_above >= 0) + and pt[2] < pt_ini[2] + and ((pt[2] - pt_ini[2]) > limit_z_above) + ): + return 0 + if ( + (limit_z_below >= 0) + and pt[2] > pt_ini[2] + and ((pt_ini[2] - pt[2]) > limit_z_below) + ): + return 0 + return 1 + else: + return 0 arrays_las, nb_points_take_2d = build_random_points_around_one_point( func_test, distance_radius