Skip to content

Commit

Permalink
clean up some more NOMINMAX
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Apr 4, 2019
1 parent 264a65e commit 2d574d6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions io/private/pubgeo/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ namespace pubgeo {

for (unsigned int j = k; j < src->height; j+=N) {
// Define row bounds:
unsigned int j1 = std::max((int) j - rad, 0);
unsigned int j2 = std::min(j + rad, src->height - 1);
unsigned int j1 = (std::max)((int) j - rad, 0);
unsigned int j2 = (std::min)(j + rad, src->height - 1);

for (unsigned int i = 0; i < src->width; i++) {
// Skip if void.
if (skipVoids && (src->data[j][i] == voidVal)) continue;

// Define bounds;
unsigned int i1 = std::max((int) i - rad, 0);
unsigned int i2 = std::min(i + rad, src->width - 1);
unsigned int i1 = (std::max)((int) i - rad, 0);
unsigned int i2 = (std::min)(i + rad, src->width - 1);

// Add valid values to the list.
for (unsigned int jj = j1; jj <= j2; jj++) {
Expand Down Expand Up @@ -179,13 +179,13 @@ namespace pubgeo {

for (unsigned int j = k; j < dest->height; j+=N) {
// Define row bounds:
unsigned int j1 = std::max((int) j - rad, 0);
unsigned int j2 = std::min(j + rad, dest->height - 1);
unsigned int j1 = (std::max)((int) j - rad, 0);
unsigned int j2 = (std::min)(j + rad, dest->height - 1);

for (unsigned int i = 0; i < dest->width; i++) {
// Define column bounds:
unsigned int i1 = std::max((int) i - rad, 0);
unsigned int i2 = std::min(i + rad, dest->width - 1);
unsigned int i1 = (std::max)((int) i - rad, 0);
unsigned int i2 = (std::min)(i + rad, dest->width - 1);

std::pair<TYPE_A,TYPE_B> ref = std::make_pair(A->data[j][i],B->data[j][i]);
if (selectFunc(ref)) {
Expand Down
4 changes: 2 additions & 2 deletions io/private/pubgeo/geo_polygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,10 +726,10 @@ class GeoPolygon {
unsigned int w = 0;
double c = 1.0/scale;
for (size_t j = i; j!=next(k); j=next(j))
wts[j]=std::min(++w,scale)*c;
wts[j]=(std::min)(++w,scale)*c;
w = 0;
for (size_t j = k; j!=prev(i); j=prev(j))
wts[j]=wts[j]*std::min(++w,scale)*c;
wts[j]=wts[j]*(std::min)(++w,scale)*c;

// Compute least squares of parametric x and y
for (size_t d = 0; d < 2; ++d) {
Expand Down
8 changes: 4 additions & 4 deletions io/private/pubgeo/orthoimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ namespace pubgeo {
int y = my*pset.y(i) + by;
TYPE z = mz*pset.z(i) + bz;

for (int y1 = std::max(y,0); y1 <= std::min(y+1,(int) this->height-1); ++y1) {
for (int x1 = std::max(x,0); x1 <= std::min(x+1,(int) this->width-1); ++x1) {
for (int y1 = (std::max)(y,0); y1 <= (std::min)(y+1,(int) this->height-1); ++y1) {
for (int x1 = (std::max)(x,0); x1 <= (std::min)(x+1,(int) this->width-1); ++x1) {
TYPE& z0 = this->data[y1][x1];
if (!z0 || compare(z,z0))
z0 = z;
Expand Down Expand Up @@ -526,12 +526,12 @@ namespace pubgeo {
// cell value to the median, we're comparing it against the specified quantile
void quantileFilter(int rad, TYPE dzScaled, float quantile, TYPE voidVal = 0, bool skipVoids = true) {
// Filter quantile
quantile = std::max(0.0f,std::min(1.0f,quantile));
quantile = (std::max)(0.0f,(std::min)(1.0f,quantile));

// Apply filter to the image
Image<TYPE>::filter([&](TYPE* val, const TYPE& ref, std::vector<TYPE> &ngbrs) {
// Find quantile
size_t ix = std::min((size_t) floor(quantile * ngbrs.size()),ngbrs.size()-1);
size_t ix = (std::min)((size_t) floor(quantile * ngbrs.size()),ngbrs.size()-1);
std::partial_sort(ngbrs.begin(), ngbrs.begin() + (ix + 1), ngbrs.end());
STYPE qValue = static_cast<STYPE>(ngbrs[ix]);
// Only replace if it differs by more than dz from the median
Expand Down

0 comments on commit 2d574d6

Please sign in to comment.