Skip to content

Commit

Permalink
fix equality
Browse files Browse the repository at this point in the history
  • Loading branch information
alavenant committed May 17, 2024
1 parent 20cac64 commit 6f2a07b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/filter_radius_assign/radius_assignFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void RadiusAssignFilter::addArgs(ProgramArgs& args)

void RadiusAssignFilter::addDimensions(PointLayoutPtr layout)
{
m_args->m_dim = layout->registerOrAssignDim(m_args->m_outputDimension, Dimension::Type::Double);
m_args->m_dim = layout->registerOrAssignDim(m_args->m_outputDimension, Dimension::Type::Unsigned8);
m_args->m_dim_ref = layout->registerOrAssignDim(m_args->m_referenceDomain,Dimension::Type::Unsigned8);
m_args->m_dim_src = layout->registerOrAssignDim(m_args->m_srcDomain,Dimension::Type::Unsigned8);
}
Expand Down 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_search_bellow>0 && Zpt>Zref && (Zpt-Zref)<m_args->m_search_bellow) {take=true; break;}
if (m_args->m_search_above>0 && Zpt<Zref && (Zref-Zpt)<m_args->m_search_above) {take=true; break;}
if (m_args->m_search_bellow>0 && Zpt>Zref && (Zpt-Zref)<=m_args->m_search_bellow) {take=true; break;}
if (m_args->m_search_above>0 && Zpt<Zref && (Zref-Zpt)<=m_args->m_search_above) {take=true; break;}
}
if (!take) return;
}
Expand Down
8 changes: 4 additions & 4 deletions test/test_radius_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_radius_assign_3d():

def func_test(pt_ini, pt):
distance_i = distance3d(pt_ini, pt)
if distance_i < distance_radius:
if distance_i <= distance_radius:
return 1
return 0

Expand All @@ -120,7 +120,7 @@ def test_radius_assign_2d():

def func_test(pt_ini, pt):
distance_i = distance2d(pt_ini, pt)
if distance_i < distance_radius:
if distance_i <= distance_radius:
return 1
return 0

Expand All @@ -136,8 +136,8 @@ def test_radius_assign_2d_cylinder():

def func_test(pt_ini, pt):
distance_i = distance2d(pt_ini, pt)
if distance_i < distance_radius:
if abs(pt_ini[2] - pt[2]) < distance_cylinder:
if distance_i <= distance_radius:
if abs(pt_ini[2] - pt[2]) <= distance_cylinder:
return 1
return 0

Expand Down

0 comments on commit 6f2a07b

Please sign in to comment.