Skip to content

Commit

Permalink
Use old method of point count for density for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Dec 10, 2015
1 parent 8a85f2d commit 4f583b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/hexbin/filters/HexBin.cpp
Expand Up @@ -66,6 +66,7 @@ void HexBin::processOptions(const Options& options)

void HexBin::ready(PointTableRef table)
{
m_count = 0;
if (m_edgeLength == 0.0) // 0 can always be represented exactly.
{
m_grid.reset(new HexGrid(m_density));
Expand All @@ -84,6 +85,7 @@ void HexBin::filter(PointView& view)
double y = view.getFieldAs<double>(pdal::Dimension::Id::Y, idx);
m_grid->addPoint(x, y);
}
m_count += view.size();
}


Expand Down Expand Up @@ -173,8 +175,8 @@ void HexBin::done(PointTableRef table)
m_metadata.add("boundary", smooth, "Approximated MULTIPOLYGON of domain");
double area = Geometry::computeArea(polygon.str());

double density = (double) m_grid->densePointCount() / area ;
std::cerr << "Area/count = " << area << "/" << m_grid->densePointCount() << "!\n";
// double density = (double) m_grid->densePointCount() / area ;
double density = (double) m_count/ area ;
m_metadata.add("density", density, "Number of points per square unit");
m_metadata.add("area", area, "Area in square units of tessellated polygon");
}
Expand Down
1 change: 1 addition & 0 deletions plugins/hexbin/filters/HexBin.hpp
Expand Up @@ -62,6 +62,7 @@ class PDAL_DLL HexBin : public Filter
int32_t m_density;
double m_edgeLength;
bool m_outputTesselation;
point_count_t m_count;

virtual void processOptions(const Options& options);
virtual void ready(PointTableRef table);
Expand Down

0 comments on commit 4f583b1

Please sign in to comment.