TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
Loading...
Searching...
No Matches
spirograph.cpp File Reference

Implementation of Spirograph More...

#include <array>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
Include dependency graph for spirograph.cpp:

Go to the source code of this file.

Namespaces

namespace  spirograph
 

Macros

#define _USE_MATH_DEFINES
 

Functions

template<std::size_t N>
void spirograph::spirograph (std::array< std::pair< double, double >, N > *points, double l, double k, double rot)
 
void spirograph::test ()
 Test function to save resulting points to a CSV file.
 
int main (int argc, char **argv)
 

Detailed Description

Implementation of Spirograph

Author
Krishna Vedala

Implementation of the program is based on the geometry shown in the figure below:

Spirograph geometry from Wikipedia

Definition in file spirograph.cpp.

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

required for MSVC compiler

Definition at line 23 of file spirograph.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Main function

Definition at line 268 of file spirograph.cpp.

268 {
270
271#ifdef USE_GLUT
272 glutInit(&argc, argv);
273 glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
274 glutCreateWindow("Spirograph");
275 glutInitWindowSize(400, 400);
276 // glutIdleFunc(glutPostRedisplay);
277 glutTimerFunc(spirograph::animation_speed, spirograph::timer_cb, 0);
278 glutKeyboardFunc(spirograph::keyboard_cb);
279 glutDisplayFunc(spirograph::test2);
280 glutMainLoop();
281#endif
282
283 return 0;
284}
void test()
Test function to save resulting points to a CSV file.