NewGamePhysics.GraphicalElements.GumowskiMiraFractal Class Reference

Renders Gumowski-Mira Fractals into a Texture. Reference: http://www.scipress.org/journals/forma/pdf/1502/15020121.pdf. More...

List of all members.

Public Member Functions

 GumowskiMiraFractal (GraphicsDevice graphicsDevice, int width, int height, double a, double mu, double x1, double y1)
 Create new instance of the Gumowski-Mira Fractal class.
void Reset ()
 Resets the iteration count and clears the buffer and texture.
void Reset (double x1, double y1)
 Resets the iteration count and clears the buffer and texture.
void Iterate (int steps)
 Iterate the recurrence for a certain number of steps, drawing pixels into the buffer and updating the texture at the end.

Properties

int Width [get]
 Gets the width of the map.
int Height [get]
 Gets the height of the map.
double A [get, set]
 Gets or sets the a parameter.
double Mu [get, set]
 Gets or sets the mu parameter.
Texture2D ImageTexture [get]
 Gets the image texture of the map.
Vector2 Center [get, set]
 Gets or sets the center coordinate of the map.
float Scale [get, set]
 Gets of set the scale of the map.
UInt32 Iterations [get]
 Gets the current number of iterations processed.

Detailed Description

Renders Gumowski-Mira Fractals into a Texture. Reference: http://www.scipress.org/journals/forma/pdf/1502/15020121.pdf.

Definition at line 12 of file GumowskiMiraFractal.cs.


Constructor & Destructor Documentation

NewGamePhysics.GraphicalElements.GumowskiMiraFractal.GumowskiMiraFractal ( GraphicsDevice  graphicsDevice,
int  width,
int  height,
double  a,
double  mu,
double  x1,
double  y1 
)

Create new instance of the Gumowski-Mira Fractal class.

Parameters:
graphiceDevice The graphics device to create the texture in.
width Width of image/texture.
height Height of image/texture
a Recurrence parameter a
mu Recurrence parameter mu
x1 Initial X coordinate
y1 Initial Y coordinate

Definition at line 114 of file GumowskiMiraFractal.cs.

00115         {
00116             // Store parameters
00117             this.graphicsDevice = graphicsDevice;
00118             this.width = width;
00119             this.height = height;
00120             this.fw = (float)width;
00121             this.fwh = this.fw / 2.0f;
00122             this.fh = (float)height;
00123             this.fhh = this.fh / 2.0f;
00124             this.a = a;
00125             this.mu = mu;
00126 
00127             // Reset buffers
00128             this.Reset(x1, y1);
00129         }


Member Function Documentation

void NewGamePhysics.GraphicalElements.GumowskiMiraFractal.Iterate ( int  steps  ) 

Iterate the recurrence for a certain number of steps, drawing pixels into the buffer and updating the texture at the end.

Parameters:
steps Number of steps to iterate.

Definition at line 245 of file GumowskiMiraFractal.cs.

00246         {
00247             double mup = 2.0 * (1.0 - this.mu);
00248             for (int i = 0; i < steps; i++)
00249             {
00250                 // Calculate 
00251                 double xx = this.x * this.x;
00252                 double fxn = this.mu * this.x + (mup * xx) / (1.0 + xx);
00253                 double xnp1 = this.y + this.a * (1.0 - 0.05 * this.y * this.y) * this.y + fxn;
00254                 double xnp1xnp1 = xnp1*xnp1;
00255                 double fxnp1 = this.mu * xnp1 + (mup * xnp1xnp1) / (1.0 + xnp1xnp1);
00256                 double ynp1 = -this.x + fxnp1;
00257                 this.x = xnp1;
00258                 this.y = ynp1;
00259                 this.iterations++;
00260 
00261                 // Draw
00262                 this.PutPixel(xnp1, ynp1, 1);
00263             }
00264 
00265             // Re-reate texture
00266             this.imageTexture = new Texture2D(
00267                 this.graphicsDevice,
00268                 this.width,
00269                 this.height,
00270                 1,
00271                 TextureUsage.None,
00272                 SurfaceFormat.Luminance8); // Could be Palette8
00273 
00274             // Update the luminance data of the texture
00275             this.imageTexture.SetData(this.imageBuffer);
00276         }

void NewGamePhysics.GraphicalElements.GumowskiMiraFractal.Reset ( double  x1,
double  y1 
)

Resets the iteration count and clears the buffer and texture.

Parameters:
x1 New initial X position.
y1 New initial Y position.

Definition at line 212 of file GumowskiMiraFractal.cs.

00213         {
00214             // Cache and reset position
00215             this.oldX1 = x1;
00216             this.oldY1 = y1;
00217             this.x = x1;
00218             this.y = y1;
00219 
00220             // Reset iteration count
00221             this.iterations = 0;
00222 
00223             // Create buffer
00224             int imageSize = width * height;
00225             this.imageBuffer = new byte[imageSize];
00226 
00227             // Create texture
00228             this.imageTexture = new Texture2D(
00229                 graphicsDevice,
00230                 width,
00231                 height,
00232                 1,
00233                 TextureUsage.None,
00234                 SurfaceFormat.Luminance8);
00235 
00236             // Update the luminance data of the texture
00237             this.imageTexture.SetData(this.imageBuffer);
00238         }

void NewGamePhysics.GraphicalElements.GumowskiMiraFractal.Reset (  ) 

Resets the iteration count and clears the buffer and texture.

Definition at line 202 of file GumowskiMiraFractal.cs.

00203         {
00204             this.Reset(this.oldX1, this.oldY1);
00205         }


Property Documentation

double NewGamePhysics.GraphicalElements.GumowskiMiraFractal.A [get, set]

Gets or sets the a parameter.

Definition at line 151 of file GumowskiMiraFractal.cs.

Vector2 NewGamePhysics.GraphicalElements.GumowskiMiraFractal.Center [get, set]

Gets or sets the center coordinate of the map.

Definition at line 177 of file GumowskiMiraFractal.cs.

int NewGamePhysics.GraphicalElements.GumowskiMiraFractal.Height [get]

Gets the height of the map.

Definition at line 143 of file GumowskiMiraFractal.cs.

Texture2D NewGamePhysics.GraphicalElements.GumowskiMiraFractal.ImageTexture [get]

Gets the image texture of the map.

Definition at line 169 of file GumowskiMiraFractal.cs.

UInt32 NewGamePhysics.GraphicalElements.GumowskiMiraFractal.Iterations [get]

Gets the current number of iterations processed.

Definition at line 195 of file GumowskiMiraFractal.cs.

double NewGamePhysics.GraphicalElements.GumowskiMiraFractal.Mu [get, set]

Gets or sets the mu parameter.

Definition at line 160 of file GumowskiMiraFractal.cs.

float NewGamePhysics.GraphicalElements.GumowskiMiraFractal.Scale [get, set]

Gets of set the scale of the map.

Definition at line 186 of file GumowskiMiraFractal.cs.

int NewGamePhysics.GraphicalElements.GumowskiMiraFractal.Width [get]

Gets the width of the map.

Definition at line 135 of file GumowskiMiraFractal.cs.


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2