Article View: borland.public.jbuilder.java.language
Article #15045Re: Need Algorithm
From: Pete Blacker
Date: Tue, 13 Jul 1999 00:00
Date: Tue, 13 Jul 1999 00:00
31 lines
1632 bytes
1632 bytes
I'm assuming you're thinking of the fire demo's that were very popular with assembler programers a few years ago. The fire is created by seeding the bottom row of a an image buffer with random values. The pixels are then recalculated for each frame to create the effect of flames. The algorithm for recalculating a pixel is, if I remember correctly it was a few years since I did it. The new value of a pixel is the average of itself and the three pixels on the row below it minus one. as shown in the tacky text diagram below: | -- | A | -- | | B | C | D | the new value of pixel A is ((A+B+C+D)/4)-1 The only exception to this will be for the first and last columns of pixels on the image. These can either be ignored, referenced but never set, or you can wrap the image. I hope this all makes sense, if you have any more questions feel free to ask. Pete Blacker cafefinal wrote: > Hello ! > I wish to create a Fire applet for my class project. Please if someone > could show me an algorithm to do the task. I do thanks in advance. :) > > - Lakra
Technical Details
Message-ID:
<378BAC00.CD5F1F74@comicjunk.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37760C91.1BB94B2C@yahoo.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,95821d93a9c36231 X-Google-Attributes: gidf74b3,public From: Pete Blacker <pete@comicjunk.com> Subject: Re: Need Algorithm Date: 1999/07/13 Message-ID: <378BAC00.CD5F1F74@comicjunk.com> X-Deja-AN: 500666780 Content-Transfer-Encoding: 7bit References: <37760C91.1BB94B2C@yahoo.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language