Skip to content

Commit

Permalink
Return 0 for out-of-range inputs in ImageBoxFilt::val
Browse files Browse the repository at this point in the history
  • Loading branch information
snogglethorpe committed Apr 30, 2012
1 parent af63b4f commit 3967fec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions image-box-filt.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef SNOGRAY_IMAGE_BOX_FILT_H
#define SNOGRAY_IMAGE_BOX_FILT_H

#include "snogmath.h"

#include "image-filter.h"


Expand All @@ -35,9 +37,9 @@ class ImageBoxFilt : public ImageFilter
: ImageFilter (params, default_radius())
{ }

virtual float val (float, float) const
virtual float val (float x_offs, float y_offs) const
{
return 1;
return (abs (x_offs) <= x_radius && abs (y_offs) <= y_radius) ? 1 : 0;
}
};

Expand Down

0 comments on commit 3967fec

Please sign in to comment.