1 /***************************************************************************
2 filter.cpp - description
3 -------------------
4 begin : july 2nd, 2006
5 copyright : (C) 2006 by Fr�d�ric RODRIGO
6 email : f.rodrigo free.fr
7
8 $Id: filter.cpp 373 2008-10-11 21:32:54Z neoneurone $
9 ***************************************************************************/
10
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * any later version. *
17 * *
18 ***************************************************************************/
19
20 #include "filter.h"
21
22 namespace MapGen
23 {
24
25 /*=====================================================================*/
Filter()26 Filter::Filter()
27 {
28 MAP_DEBUG( "ctor" );
29 }
30
31
32 /*=====================================================================*/
~Filter()33 Filter::~Filter()
34 {
35 MAP_DEBUG( "dtor" );
36 }
37
38
39 /*=====================================================================*/
_getMinMax(const Map * map,float & min,float & max)40 void Filter::_getMinMax(
41 const Map* map,
42 float& min,
43 float& max )
44 {
45 float val = 0;
46
47 min = max = map->getAt( 0, 0 );
48
49 uint w = map->getW();
50 uint h = map->getL();
51
52 for( uint x = 0; x < w; ++x )
53 for( uint y = 0; y < h; ++y ) {
54 val = map->getAt( x, y );
55 if( val < min )
56 min = val;
57 if( val > max )
58 max = val;
59 }
60 }
61
62 }
63