doc: Make table of contents output more flexible. This re-introduces the indentation...
[Ale.git] / d2 / filter / box.h
blobd4e72a41228dd0c0319e96878b8f5e1933c26c58
1 // Copyright 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __d2_filter_box_h__
22 #define __d2_filter_box_h__
25 * A box filter class.
28 class box : public filter {
29 private:
30 ale_real half_width;
33 * Box filter.
35 ale_real _box(ale_pos p) const {
36 if (fabs(p) > half_width)
37 return 0;
39 return 1;
42 ale_real _box(point p) const {
43 return _box(p[0]) * _box(p[1]);
46 public:
49 * Size of filter support, in number of half-cycles to each side of the
50 * filter center.
52 ale_real support() const {
53 return half_width;
57 * Response of filter at point p
59 virtual ale_real response(point p) const {
60 return _box(p);
63 virtual int equals(const filter *f) const {
64 if (typeid(*f) == typeid(*this))
65 return ((box *)f)->half_width == half_width;
66 return 0;
69 box(ale_real half_width) {
70 this->half_width = half_width;
74 #endif