Skip to content

Commit

Permalink
And more...
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed May 14, 2018
1 parent f3f6875 commit 768f864
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pdal/DimUtil.hpp
Expand Up @@ -103,7 +103,7 @@ inline BaseType base(Type t)
return BaseType(Utils::toNative(t) & 0xFF00);
}

static const int COUNT = std::numeric_limits<uint16_t>::max();
static const int COUNT = (std::numeric_limits<uint16_t>::max)();
static const int PROPRIETARY = 0xF000;

/// Get a string reresentation of a datatype.
Expand Down
57 changes: 30 additions & 27 deletions pdal/QuadIndex.cpp
Expand Up @@ -46,17 +46,18 @@ namespace

struct BBox
{
BBox(Point min, Point max)
: min(min)
, max(max)
, center(min.x + (max.x - min.x) / 2, min.y + (max.y - min.y) / 2)
, halfWidth(center.x - min.x)
, halfHeight(center.y - min.y)
BBox(Point minimum, Point maximum)
: minimum(minimum)
, maximum(maximum)
, center(minimum.x + (maximum.x - minimum.x) / 2,
minimum.y + (maximum.y - minimum.y) / 2)
, halfWidth(center.x - minimum.x)
, halfHeight(center.y - minimum.y)
{ }

BBox(const BBox& other)
: min(other.min)
, max(other.max)
: minimum(other.minimum)
, maximum(other.maximum)
, center(other.center)
, halfWidth(other.halfWidth)
, halfHeight(other.halfHeight)
Expand Down Expand Up @@ -88,11 +89,12 @@ namespace
// Returns true if the requested point is contained within this BBox.
bool contains(const Point& p) const
{
return p.x >= min.x && p.y >= min.y && p.x < max.x && p.y < max.y;
return p.x >= minimum.x && p.y >= minimum.y &&
p.x < maximum.x && p.y < maximum.y;
}

const Point min;
const Point max;
const Point minimum;
const Point maximum;

// Pre-calculate these properties, rather than exposing functions to
// calculate them on-demand, due to the large number of times that
Expand Down Expand Up @@ -193,7 +195,7 @@ std::size_t Tree::addPoint(const QuadPointRef* toAdd, const std::size_t curDepth
{
sw.reset(new Tree(
BBox(
Point(bbox.min.x, bbox.min.y),
Point(bbox.minimum.x, bbox.minimum.y),
Point(center.x, center.y)),
toAdd));

Expand All @@ -210,8 +212,8 @@ std::size_t Tree::addPoint(const QuadPointRef* toAdd, const std::size_t curDepth
{
nw.reset(new Tree(
BBox(
Point(bbox.min.x, center.y),
Point(center.x, bbox.max.y)),
Point(bbox.minimum.x, center.y),
Point(center.x, bbox.maximum.y)),
toAdd));

return nextDepth;
Expand All @@ -230,8 +232,8 @@ std::size_t Tree::addPoint(const QuadPointRef* toAdd, const std::size_t curDepth
{
se.reset(new Tree(
BBox(
Point(center.x, bbox.min.y),
Point(bbox.max.x, center.y)),
Point(center.x, bbox.minimum.y),
Point(bbox.maximum.x, center.y)),
toAdd));

return nextDepth;
Expand All @@ -248,7 +250,7 @@ std::size_t Tree::addPoint(const QuadPointRef* toAdd, const std::size_t curDepth
ne.reset(new Tree(
BBox(
Point(center.x, center.y),
Point(bbox.max.x, bbox.max.y)),
Point(bbox.maximum.x, bbox.maximum.y)),
toAdd));

return nextDepth;
Expand Down Expand Up @@ -642,10 +644,10 @@ void QuadIndex::QImpl::getBounds(
{
if (m_tree)
{
xMin = m_tree->bbox.min.x;
yMin = m_tree->bbox.min.y;
xMax = m_tree->bbox.max.x;
yMax = m_tree->bbox.max.y;
xMin = m_tree->bbox.minimum.x;
yMin = m_tree->bbox.minimum.y;
xMax = m_tree->bbox.maximum.x;
yMax = m_tree->bbox.maximum.y;
}
}

Expand Down Expand Up @@ -692,15 +694,16 @@ std::vector<PointId> QuadIndex::QImpl::getPoints(
if (m_tree)
{
const std::size_t exp(std::pow(2, rasterize));
const double xWidth(m_tree->bbox.max.x - m_tree->bbox.min.x);
const double yWidth(m_tree->bbox.max.y - m_tree->bbox.min.y);
const double xWidth(m_tree->bbox.maximum.x - m_tree->bbox.minimum.x);
const double yWidth(m_tree->bbox.maximum.y - m_tree->bbox.minimum.y);

xStep = xWidth / exp;
yStep = yWidth / exp;
xBegin = m_tree->bbox.min.x + (xStep / 2);
yBegin = m_tree->bbox.min.y + (yStep / 2);
xEnd = m_tree->bbox.max.x + (xStep / 2); // One tick past the end.
yEnd = m_tree->bbox.max.y + (yStep / 2);
xBegin = m_tree->bbox.minimum.x + (xStep / 2);
yBegin = m_tree->bbox.minimum.y + (yStep / 2);
// One tick past the end.
xEnd = m_tree->bbox.maximum.x + (xStep / 2);
yEnd = m_tree->bbox.maximum.y + (yStep / 2);

results.resize(exp * exp, (std::numeric_limits<PointId>::max)());

Expand Down
12 changes: 6 additions & 6 deletions pdal/Scaling.cpp
Expand Up @@ -75,20 +75,20 @@ void Scaling::setAutoXForm(const PointViewPtr view)
if (xmod)
{
double x = view->getFieldAs<double>(Dimension::Id::X, idx);
xmin = std::min(x, xmin);
xmax = std::max(x, xmax);
xmin = (std::min)(x, xmin);
xmax = (std::max)(x, xmax);
}
if (ymod)
{
double y = view->getFieldAs<double>(Dimension::Id::Y, idx);
ymin = std::min(y, ymin);
ymax = std::max(y, ymax);
ymin = (std::min)(y, ymin);
ymax = (std::max)(y, ymax);
}
if (zmod)
{
double z = view->getFieldAs<double>(Dimension::Id::Z, idx);
zmin = std::min(z, zmin);
zmax = std::max(z, zmax);
zmin = (std::min)(z, zmin);
zmax = (std::max)(z, zmax);
}
}

Expand Down

0 comments on commit 768f864

Please sign in to comment.