Skip to content

Commit

Permalink
Better comment on path elimination logic.
Browse files Browse the repository at this point in the history
Move init/finish to unnamed namespace in Geometry.
  • Loading branch information
abellgithub committed Nov 17, 2015
1 parent d5b1140 commit 2d66457
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
10 changes: 5 additions & 5 deletions include/pdal/Geometry.hpp
Expand Up @@ -76,11 +76,6 @@ static void GEOSWarningHandler(const char *fmt, ...)
va_end(args);
}

} // Unnamed namespace

namespace Geometry
{

static GEOSContextHandle_t init()
{
if (s_contextCnt == 0)
Expand All @@ -96,6 +91,11 @@ static void finish()
finishGEOS_r(s_environment);
}

} // Unnamed namespace

namespace Geometry
{

static std::string smoothPolygon(const std::string& wkt, double tolerance)
{
GEOSContextHandle_t env = init();
Expand Down
17 changes: 13 additions & 4 deletions plugins/hexbin/filters/HexBin.cpp
Expand Up @@ -143,10 +143,19 @@ void HexBin::done(PointTableRef table)
m_metadata.add("boundary", polygon.str(),
"Boundary MULTIPOLYGON of domain");

const double SQRT_3(1.732050808);
// This is just a little longer than the prependicular distance of the
// "humps."
// double tolerance = 1.1 * m_grid->height() / (2 * SQRT_3);
// We want to make these bumps on edges go away, which means that
// we want to elimnate both B and C. If we take a line from A -> C,
// we need the tolerance to eliminate B. After that we're left with
// the triangle ACD and we want to eliminate C. The perpendicular
// distance from AD to C is the hexagon height / 2, so we set the
// tolerance a little larger than that. This is larger than the
// perpendicular distance needed to eliminate B in ABC, so should
// serve for both cases.
//
// B ______ C
// / \
// A / \ D
//
double tolerance = 1.1 * m_grid->height() / 2;
m_metadata.add("smoothed_boundary",
Geometry::smoothPolygon(polygon.str(), tolerance),
Expand Down

0 comments on commit 2d66457

Please sign in to comment.