Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!linus!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!cernvax!chx400!chx400!bernina!neptune!iiic.ethz.ch!umueller From: umueller@iiic.ethz.ch (Urban Dominik Mueller) Newsgroups: comp.sys.amiga.programmer Subject: Re: Clicking on irregular shapes? Message-ID: <27927@neptune.inf.ethz.ch> Date: 9 Apr 91 13:13:27 GMT References: <1991Apr05.104141.2118@cs.ruu.nl> <27867@neptune.inf.ethz.ch> <1079@cbmger.UUCP> Sender: news@neptune.inf.ethz.ch Reply-To: umueller@iiic.ethz.ch (Urban Dominik Mueller) Organization: Departement Informatik, ETH, Zurich Lines: 36 >I always have moot feelings with such analytical algorithms. Often >you have to compare for equality of real numbers, which is normally >a NO-NO. You would have to convert coordinates to integers only to >do this algorithm on them. It's not that bad, in order to find out whether a point is a local maximum or minimum, you need only check for less-equal. Additionally, you can often work with integer arithmetics when it comes to gfx. For example the guy who started this thread is programming a game, I doubt he works with reals. >Look for another example at this shape, would it be >processed correctly? > /\ > / \ /\ > / O \_____/ \ > /_______________\ > >The O is thought to be on the same y coordinate as the horiz. line Yes, it works. If you have defined a local minimum to be a point whose neighbours have higher *or same* y-coordinates, you've got two minima here, which aren't counted. This works even of that horizontal line consists of more than one edge. But it's really good to be suspicious, I know a lot of people (including my CS prof) who have trouble getting that problem right... Not counting all the bad solutions that were posted on this net. Ah yes, I have to join that guy who recommended the Sedgewick book, it's a must for any good programmer. >Best regards, Dr. Peter Kittel // E-Mail to \\ Only my personal opinions.. __ | Urban Mueller | / / | Urban Mueller | | INTERNET:umueller@iiic.ethz.ch | __ / / | Schulhausstr. 83 | | FIDONET: 2:302/906 (AUGL) | \ \/ / | CH-6312 Steinhausen | | "Don't tell my employer" | \__/ | SWITZERLAND |