Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
alavenant committed Oct 3, 2024
1 parent 2fbc333 commit 6dc6920
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/filter_radius_assign/RadiusAssignFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ void RadiusAssignFilter::doOneNoDomain(PointRef &point)
for (PointId ptId : iNeighbors)
{
double Zpt = refView->point(ptId).getFieldAs<double>(Dimension::Id::Z);
if (m_args->m_max2d_below>=0 && Zref<Zpt && (Zref-Zpt)<m_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 (m_args->m_max2d_below>=0 && Zref<Zpt && (Zref-Zpt)>m_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;
}
Expand Down
28 changes: 15 additions & 13 deletions test/test_radius_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6dc6920

Please sign in to comment.