Open main menu

CDOT Wiki β

Changes

The B-Team

2,582 bytes added, 01:22, 21 November 2012
Created page with '{{GPU610/DPS915 Index | 20123}} = The B-Team = == Team Members == # [mailto:kmbarnhart@learn.senecac.on.ca?sujbect=DPS915 Kyle Barnhart] == Mandelbrot Set == === Repo === https…'
{{GPU610/DPS915 Index | 20123}}
= The B-Team =
== Team Members ==
# [mailto:kmbarnhart@learn.senecac.on.ca?sujbect=DPS915 Kyle Barnhart]

== Mandelbrot Set ==
=== Repo ===
https://github.com/KyleBarnhart/Fractal

=== Description ===
I wrote this program because I could not find a suitable fractal program. This program generates fractal images of the Mandelbrot Set and saves them in the BMP image format. It can generate images of an almost arbitrary size. You also set the locations, number of iterations, and the zoom factor. It uses a smoothing algorithm and a histogram to create smoothly and evenly coloured images. It has selective super sampling for anti-aliasing. And it can generate a sequence of images that can be put together to make a video. In testing the program I made a video (http://www.youtube.com/watch?v=vQigSMuHxuU).

=== Code ===
<pre>
inline ElementType mandelbrot(ElementType c_r, ElementType c_i, IterationType iterations)
{
ElementType z_r = c_r;
ElementType z_i = c_i;

ElementType z2_r = z_r * z_r;
ElementType z2_i = z_i * z_i;

IterationType n = 0;

while(n < iterations && z2_r + z2_i < 4.0)
{
z_i = 2.0 * z_r * z_i + c_i;
z_r = z2_r - z2_i + c_r;

z2_r = z_r * z_r;
z2_i = z_i * z_i;

n++;
}

z_i = 2.0 * z_r * z_i + c_i;
z_r = z2_r - z2_i + c_r;

z2_r = z_r * z_r;
z2_i = z_i * z_i;

z_i = 2.0 * z_r * z_i + c_i;
z_r = z2_r - z2_i + c_r;

z2_r = z_r * z_r;
z2_i = z_i * z_i;

n += 2;

if(n > iterations)
{
return (ElementType)iterations;
}
else
{
return (ElementType)n + 1.0 - log(log(sqrt(z2_r + z2_i)))/log(2.0);;
}
}
</pre>


== Calculating Pi ==
=== Repo ===
https://github.com/KyleBarnhart/Pi

=== Description ===
I wrote this program based on reading some articles I found. The program calculates the value of pi by randomly generating points in a one by one area and determining if they are no more than a distance of one from the bottom left corner (0, 0). By randomly generating many uniformly distributed numbers and dividing the number that fall within the circle by the number of iterations you can determine pi. The more iterations that you preform, the closer the value will be to pi.

=== Code ===
<pre>
inline double moreRandom(unsigned iterations)

{

double result = (double)rand() / (double)RAND_MAX;



for(unsigned i = 1; i < iterations; i++)

{

result = (((double)rand()) + result) / (double)RAND_MAX;

}



return result;

}


</pre>
1
edit