Skip to content

Commit

Permalink
fix : name, orthograph, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
alavenant committed May 17, 2024
1 parent 6f2a07b commit a2cf0be
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions doc/grid_radius_assign.md → doc/radius_assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Options

**is3d**: Search in 3d (as a ball). [Default: false]

**is2d_above**: If is3d is false, take points only if exists points between the referent point and a distance above. [Default: 0.]
**is2d_above**: If search in 2d : upward maximum distance in Z for potential neighbors (corresponds to a search in a cylinder with a height = is2d_above above the source point). Default (0) = infinite height [Default: 0.]

**is2d_bellow**: If is3d is false, take points only if exists points between the referent point and a distance bellow. [Default: 0.]
**is2d_below**: If search in 2d : upward maximum distance in Z for potential neighbors (corresponds to a search in a cylinder with a height = is2d_below below the source point). Default (0) = infinite height [Default: 0.]

2 changes: 1 addition & 1 deletion macro/macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def add_grid_decimation(pipeline, grid_resolution, output_type, condition, condi
"""
pipeline |= pdal.Filter.ferry(dimensions=f"=>grid,")
pipeline |= pdal.Filter.assign(value="grid = 0")
pipeline |= pdal.Filter.grid_decimation(resolution=grid_resolution, output_name_attribut="grid",
pipeline |= pdal.Filter.grid_decimation(resolution=grid_resolution, output_name_attribute="grid",
output_type=output_type, where=condition)
pipeline |= pdal.Filter.assign(value=condition_out,where=f"grid==0 && ({condition})")
return pipeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
****************************************************************************/

#include "grid_decimationFilter.hpp"
#include "GridDecimationFilter.hpp"

#include <pdal/PointView.hpp>
#include <pdal/StageFactory.hpp>
Expand Down Expand Up @@ -39,7 +39,7 @@ void GridDecimationFilter::addArgs(ProgramArgs& args)
{
args.add("resolution", "Cell edge size, in units of X/Y",m_args->m_edgeLength, 1.);
args.add("output_type", "Point keept into the cells ('min', 'max')", m_args->m_methodKeep, "max" );
args.add("output_name_attribut", "Name of the added attribut", m_args->m_nameAddAttribut, "grid" );
args.add("output_name_attribute", "Name of the added attribut", m_args->m_nameAddAttribute, "grid" );
args.add("output_wkt", "Export the grid as wkt", m_args->m_nameWktgrid, "" );

}
Expand All @@ -61,7 +61,7 @@ void GridDecimationFilter::ready(PointTableRef table)
if (m_args->m_methodKeep != "max" && m_args->m_methodKeep != "min")
throwError("The output_type must be 'max' or 'min'.");

if (m_args->m_nameAddAttribut.empty())
if (m_args->m_nameAddAttribute.empty())
throwError("The output_name_attribut must be given.");

if (!m_args->m_nameWktgrid.empty())
Expand All @@ -70,7 +70,7 @@ void GridDecimationFilter::ready(PointTableRef table)

void GridDecimationFilter::addDimensions(PointLayoutPtr layout)
{
m_args->m_dim = layout->registerOrAssignDim(m_args->m_nameAddAttribut,
m_args->m_dim = layout->registerOrAssignDim(m_args->m_nameAddAttribute,
Dimension::Type::Double);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PDAL_DLL GridDecimationFilter : public Filter
{
std::string m_methodKeep; // type of output (min, max)
double m_edgeLength; // lenght of grid
std::string m_nameAddAttribut; // name of the new attribut
std::string m_nameAddAttribute; // name of the new attribut
std::string m_nameWktgrid; // export wkt grid
Dimension::Id m_dim;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "radius_assignFilter.hpp"
#include "RadiusAssignFilter.hpp"

#include <pdal/PipelineManager.hpp>
#include <pdal/StageFactory.hpp>
Expand Down Expand Up @@ -37,8 +37,8 @@ void RadiusAssignFilter::addArgs(ProgramArgs& args)
args.add("radius", "Distance of neighbors to consult", m_args->m_radius, 1.);
args.add("output_dimension", "Name of the added attribut", m_args->m_outputDimension, "radius");
args.add("is3d", "Search in 3d", m_args->search3d, false );
args.add("is2d_above", "if search in 2d : filter point above the distance", m_args->m_search_bellow, 0.);
args.add("is2d_bellow", "if search in 2d : filter point bellow the distance", m_args->m_search_above, 0.);
args.add("is2d_above", "if search in 2d : upward maximum distance in Z for potential neighbors (corresponds to a search in a cylinder with a height = is2d_above above the source point). Default (0) = infinite height", m_args->m_search_above, 0.);
args.add("is2d_below", "if search in 2d : upward maximum distance in Z for potential neighbors (corresponds to a search in a cylinder with a height = is2d_below below the source point). Default (0) = infinite height", m_args->m_search_below, 0.);
}

void RadiusAssignFilter::addDimensions(PointLayoutPtr layout)
Expand Down Expand Up @@ -81,13 +81,13 @@ void RadiusAssignFilter::doOneNoDomain(PointRef &point)
if (!m_args->search3d)
{
double Zref = point.getFieldAs<double>(Dimension::Id::Z);
if (m_args->m_search_bellow>0 || m_args->m_search_above>0)
if (m_args->m_search_below>0 || m_args->m_search_above>0)
{
bool take (false);
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_below>0 && Zpt>Zref && (Zpt-Zref)<=m_args->m_search_below) {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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PDAL_DLL RadiusAssignFilter : public Filter
Dimension::Id m_dim;
bool search3d;
Dimension::Id m_dim_ref, m_dim_src;
double m_search_bellow, m_search_above;
double m_search_below, m_search_above;
};
std::unique_ptr<RadiusAssignArgs> m_args;
PointViewPtr refView;
Expand Down
2 changes: 1 addition & 1 deletion test/test_grid_decimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def run_filter(type):
"type": filter,
"resolution": resolution,
"output_type": type,
"output_name_attribut": "grid",
"output_name_attribute": "grid",
"output_wkt": tmp_out_wkt,
},
{
Expand Down
2 changes: 1 addition & 1 deletion test/test_radius_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def run_filter(arrays_las, distance_radius, search_3d, distance_cylinder=0. ):
"output_dimension": "radius_search",
"is3d": search_3d,
"is2d_above": distance_cylinder,
"is2d_bellow": distance_cylinder,
"is2d_below": distance_cylinder,
}
]

Expand Down

0 comments on commit a2cf0be

Please sign in to comment.