RE: [Algorithms] Modifying the min and max altitude in a heightma p
Brought to you by:
vexxed72
From: Robert D. <RD...@ac...> - 2000-08-01 10:53:18
|
He could however optimise the occasions when he does the full rescan, by checking to see if the value you are replacing was the maximum value, in which case it is _possible_ but by no means certain that your max value has decreased. Or even, when tracking the maximum value, keep a count of how many match the maximum (after all you will have to scan at the outset, so can get the initial count there) and then if you increase the max, it becomes 1 (ie just the new entry) and if you replace an entry with the current max height, with a lower value, you can decrement the count. If the count of max height entries reaches zero, then do a rescan. Oh, and make sure if you replace an entry with a new one which matches the max value that you increment the count too. Still doesn't solve the basic problem that you have to do a rescan occasionally, but stops you doing it when you really don't need to. Rob -----Original Message----- From: Jamie Fowlston [mailto:j.f...@re...] Sent: 01 August 2000 11:35 To: gda...@li... Subject: Re: [Algorithms] Modifying the min and max altitude in a heightmap Unless you maintain a list of heixels sorted by height, I'm pretty sure you can't do what you want. Sorry. Jamie Sam McGrath wrote: > This may have a simple solution, but I haven't thought of one yet... > > I have a heightmap of altitude values. The heightmap is subject to > modification during the course of my program. When I load the heightmap I > compute the maximum and minimum values (altitudes). During the program, if > a value in heightmap that is modified goes beyond the maximum altitude, I > assign that value to the maximum altitude (and similarly for the minimum > altitude). > > However, I also want to be able to tell if the maximum value has _shrunk_ > (or if this minimum value has increased). So far I can't think of a simple > way to do this other than rescanning the whole heightmap whenever a value is > modified, and clearly this is not a practical solution. > > Hopefully there's a nice simple method that I'm blind to, so please > enlighten me if you can. (-: > > -Sam > ______________________ > Sam McGrath > sa...@dn... > http://www.dnai.com/~sammy > ICQ 5151160 > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list _______________________________________________ GDAlgorithms-list mailing list GDA...@li... http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |