Fractal tree: Difference between revisions

Use library defined M_PI instead of "manual" precision.
m (→‎{{header|Wren}}: Changed to Wren S/H)
imported>Qn1
(Use library defined M_PI instead of "manual" precision.)
Line 551:
 
{{libheader|SGE}} or {{libheader|cairo}}
<syntaxhighlight lang="c" line="1">#include <SDL/SDL.h>
#ifdef WITH_CAIRO
#include <cairo.h>
Line 562:
#include <math.h>
 
#ifndef M_PI
#ifdef WITH_CAIRO
#define PIM_PI 3.141592653514159265358979323846
#endif
 
#define SIZE 800 // determines size of window
#define SCALE 5 // determines how quickly branches shrink (higher value means faster shrinking)
Line 627:
0.0, -1.0,
INITIAL_LENGTH,
PIM_PI / 8,
BRANCHES);
SDL_UpdateRect(surface, 0, 0, 0, 0);
Line 664:
 
//--------------------------------------------------------------------------------------------------
#ifndef M_PI
const float PI = 3.1415926536f;
#define M_PI 3.14159265358979323846
#endif
 
//--------------------------------------------------------------------------------------------------
Line 786 ⟶ 788:
public:
fractalTree() { _ang = DegToRadian( 24.0f ); }
float DegToRadian( float degree ) { return degree * ( PIM_PI / 180.0f ); }
 
void create( myBitmap* bmp )
Anonymous user