Skip to content

hunahpu/Madelbrot-Set-Cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPPND: Capstone Mandelbrot Set Explorer

This is a the repository for the fifth and last project of the Udacity C++ Nanodegree Program.

The code base can be divided architecturally and functionally into two distinct class-based components:

  • Renderer component is responsible for rendering and control the explorer of the Mandelbrot set using the popular SDL library
  • Fractal component constructs and maintains the fractal calculations and information of the explorer such as zoom, number of iterations and position of the explorer.

Once the explorer starts the user can explore the mandelbrot fractal for instructions check the controls section , an example is shown below

Example

Dependencies for Running Locally

Basic Build Instructions

  1. Clone this repo.
  2. Make a build directory in the top level directory: mkdir build && cd build
  3. Compile: cmake .. && make
  4. Run it: ./Mandelbrot.

Controls

  • Use arrow eys to explore the mandelbrot set
  • Use z/x keys to increment/decrement number of iterations
  • Use c/v keys to zoom in/zoom out
  • Use esc key to close

Rubric Items Matched

1 Object Oriented Programming - The project uses Object Oriented Programming techniques.

The project code is organized into classes with class attributes to hold the data, and class methods to perform tasks.

To meet this requirement, a Fractal class was created to hold information about the fractal. Another class Rendered is created to manage the window renderer and control fucntions.

2 Object Oriented Programming - Classes use appropriate access specifiers for class members.

All class data members are explicitly specified as public, protected, or private.

Within metagame.h, the private variable platformUsed (line 19) is used to store the user's detected system. No other class can mutate this variable.

3 Object Oriented Programming - Class constructors utilize member initialization lists.

All class members that are set to argument values are initialized through member initialization lists.

Inside Fractal and Renderer class both constructors use initialization lists to initialize the height and width of the Fractal and Window respectively.

4 More ActionsThe project makes use of references in function declarations.

At least two variables are defined as references, or two functions use pass-by-reference in the project code.

In Renderer class the method loop and controlleruse a reference to an object of the fractal class in order to modify its state.

5 The project uses destructors appropriately.

At least one class that uses unmanaged dynamically allocated memory, along with any class that otherwise needs to modify state upon the termination of an object, uses a destructor.

Fractal class uses a raw pointer to as an array to store the calculations of the Mandelbrot set, the destructor of this class frees the memory allocated by this pointer, Renderer class use a destructor to delete properly the window and render objects of the SDL library.

The project uses multithreading.

The project uses multiple threads in the execution.

The Fractal class use multhithreading to speed up the calculations of the mandelbrot fractal.

References

About

Madelbrot Set C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published