Article View: sci.fractals
Article #218Help with making the PLASMA image in C
From: Johansen, Trond Robert 6-96
Date: Wed, 18 Nov 1992 09:24
Date: Wed, 18 Nov 1992 09:24
47 lines
2187 bytes
2187 bytes
I am new in fractals, but I am trying to learn about it by making my own
pictures. I am making a recursive function that is suppost to draw the
plasma picture. The functions get a rectangle and divides this rectangel
into four "simmular" rectangels inside the first, and so on. My problem now
is how to calculate the colours. I know that the colours (of the four
corners) depends uppon a random value, and the "mother" rectangle, but HOW
does it depend? I also know that when the rectangle is big (at the start of
recursion), then the colour depends more of the random than of the colours
of the "mother" rectangle.
The function that I have made is short and easy, and I'll explain what the
variables is here:
(x1,y1) Upper left corner of the rectangle
(x2,y2) Lower rigt corner of the rectangle
fov Colour to upper left corner
foh Colour to upper right corner
fnv Colour to lower left corner
fnh Colour to lower right corner
Her is the function :
void plasma(int x1,int y1,int x2,int y2,
int fov,int foh,int fnv,int fnh)
{
/*?????? Calculate the colours (fov,foh,fnv and fng) ?????????*/
if (y2>y1+1)
{ plasma(x1,y1,((x1+x2)>>1),((y1+y2)>>1),fov,foh,fnv,fnh);
plasma(((x1+x2)>>1),y1,x2,((y1+y2)>>1),fov,foh,fnv,fnh);
plasma(((x1+x2)>>1),((y1+y2)>>1),x2,y2,fov,foh,fnv,fnh);
plasma(x1,((y1+y2)>>1),((x1+x2)>>1),y2,fov,foh,fnv,fnh);
}
else
{ putpixel(x1,y1,fov);
putpixel(x2,y1,foh);
putpixel(x1,y2,fnv);
putpixel(x2,y2,fnh);
}
I dont know if this is the kind of questions that peopel ask here, but
anyway I will be greatfull for all the help I gets.
Trond Robert Johansen
DNORT@GRIBB.HSR.NO (Internett)
Technical Details
Message-ID:
<DNORT.1.722078665@gribb.hsr.no>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!alf.uib.no!hsr.no!elektro2.hsr.no!DNORTShow Full Headers
Complete Article Headers
Newsgroups: sci.fractals Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!alf.uib.no!hsr.no!elektro2.hsr.no!DNORT From: DNORT@gribb.hsr.no (Johansen, Trond Robert 6-96) Subject: Help with making the PLASMA image in C Message-ID: <DNORT.1.722078665@gribb.hsr.no> Keywords: How to calculate the colours ? Lines: 47 Sender: news@hsr.no Organization: Rogaland University Centre Date: Wed, 18 Nov 1992 09:24:25 GMT Lines: 47