[pdal-commits] [PDAL/PDAL] 526392: Clamp values to min/max range (#3050)
Andrew Bell
noreply at github.com
Tue Apr 28 08:41:16 PDT 2020
Branch: refs/heads/master
Home: https://github.com/PDAL/PDAL
Commit: 526392cfedbf07ca141797f83bc6e88eed871b62
https://github.com/PDAL/PDAL/commit/526392cfedbf07ca141797f83bc6e88eed871b62
Author: Andrew Bell <andrew.bell.ia at gmail.com>
Date: 2020-04-28 (Tue, 28 Apr 2020)
Changed paths:
M filters/ColorinterpFilter.cpp
M filters/ColorinterpFilter.hpp
M test/unit/filters/ColorinterpFilterTest.cpp
Log Message:
-----------
Clamp values to min/max range (#3050)
* Enable clamping in colorinterp filter
Fixes #2729.
Previously values outside a determined range would be left with
default values, potentially providing unexpected results. This
commit adds a `clamp` parameter to a user can explicitly control
whether values outside the given range will be colored.
There apparently an explicit design decision to not include
values equal to the maximum in the coloring. When clamping, this
design then resulted in values that were greated than the max to
still be left uncolored. Since nothing in the available user
documentation explicitly states that the valid range is exclusive
of the maximum value it has been changed to be inclusive.
This required modifying two unit tests which were testing for
maximum values to be excluded from the coloring.
An other approach could have beent to clamp to a value slightly
less than m_max (e.g. m_max - DBL_EPSILON). But this would still
leave a discrepancy between the documentation and the implementation.
* Address comments from PR PDAL/PDAL#3046
* Removed single line `if` statements
* Simplified clamping `position` to use `std::min`
* Guard std::min.
* Minimize code change.
Co-authored-by: Matt Csencsits <matt.csencsits at minevisionsystems.com>
More information about the pdal-commits
mailing list