ADD_DEMO(subwin progs/demos/subwin/subwin.c)
ADD_DEMO(timer progs/demos/timer/timer.c)
-# finally, if any demos are built, copy needed files to output directory
-# (currently, thats just the input file for the Fractals demo)
-IF(FREEGLUT_BUILD_DEMOS)
- # 1) copy fractals.dat from freeglut/progs/demos/Fractals
- IF(BUILD_SHARED_LIBS)
- SET(Frac_target Fractals)
- ELSE()
- SET(Frac_target Fractals_static)
- ENDIF()
- GET_TARGET_PROPERTY(DEMO_OUTPUT_DIRECTORY ${Frac_target} RUNTIME_OUTPUT_DIRECTORY)
- ADD_CUSTOM_COMMAND(
- TARGET ${Frac_target}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy
- ${PROJECT_SOURCE_DIR}/progs/demos/Fractals/fractals.dat
- ${DEMO_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}
- )
-ENDIF()
-
# pkg-config support, to install at $(libdir)/pkgconfig
# Define static build dependencies
IF(WIN32)
#include <stdlib.h>
#include <string.h>
#include <math.h>
+#define FGH_PI 3.14159265358979323846
typedef struct
{
else /* No data file, set a default */
{
printf ( "ERROR opening file <%s>\n", fnme ) ;
- strcpy ( window_title, "Cantor Dust" ) ;
- num_trans = 2 ;
+ strcpy ( window_title, "Koch Snowflake" ) ;
+ num_trans = 4 ;
affine = (AffineTrans *)malloc ( num_trans * sizeof(AffineTrans) ) ;
- affine[0].a00 = 0.25 ; affine[0].a01 = 0.00 ; affine[0].a10 = 0.00 ; affine[0].a11 = 0.25 ;
+ affine[0].a00 = 1/3. ; affine[0].a01 = 0.00 ; affine[0].a10 = 0.00 ; affine[0].a11 = 1/3. ;
affine[0].b0 = 0.0 ; affine[0].b1 = 0.0 ;
- affine[1].a00 = 0.25 ; affine[1].a01 = 0.00 ; affine[1].a10 = 0.00 ; affine[1].a11 = 0.25 ;
- affine[1].b0 = 0.5 ; affine[1].b1 = 0.0 ;
+
+ affine[1].a00 = 1/6. ; affine[1].a01 = -1/3.*sin(FGH_PI/3.) ; affine[1].a10 = 1/3.*sin(FGH_PI/3.) ; affine[1].a11 = 1/6. ;
+ affine[1].b0 = 1/3. ; affine[1].b1 = 0.0 ;
+
+ affine[2].a00 = 1/6. ; affine[2].a01 = -1/3.*sin(-FGH_PI/3.) ; affine[2].a10 = 1/3.*sin(-FGH_PI/3.) ; affine[2].a11 = 1/6. ;
+ affine[2].b0 = 0.5 ; affine[2].b1 = sqrt(3)/6. ;
+
+ affine[3].a00 = 1/3. ; affine[3].a01 = 0.00 ; affine[3].a10 = 0.00 ; affine[3].a11 = 1/3. ;
+ affine[3].b0 = 2/3. ; affine[3].b1 = 0.0 ;
}
for ( i = 0; i < num_trans; i++ )
#include <stdlib.h>
#include <string.h>
#include <math.h>
+#define FGH_PI 3.14159265358979323846
#ifdef _MSC_VER
/* DUMP MEMORY LEAKS */
#include <crtdbg.h>
else /* No data file, set a default */
{
printf ( "ERROR opening file <%s>\n", fnme ) ;
- strcpy ( window_title, "Cantor Dust" ) ;
- num_trans = 2 ;
+ strcpy ( window_title, "Koch Snowflake" ) ;
+ num_trans = 4 ;
affine = (AffineTrans *)malloc ( num_trans * sizeof(AffineTrans) ) ;
- affine[0].a00 = 0.25 ; affine[0].a01 = 0.00 ; affine[0].a10 = 0.00 ; affine[0].a11 = 0.25 ;
+ affine[0].a00 = 1/3. ; affine[0].a01 = 0.00 ; affine[0].a10 = 0.00 ; affine[0].a11 = 1/3. ;
affine[0].b0 = 0.0 ; affine[0].b1 = 0.0 ;
- affine[1].a00 = 0.25 ; affine[1].a01 = 0.00 ; affine[1].a10 = 0.00 ; affine[1].a11 = 0.25 ;
- affine[1].b0 = 0.5 ; affine[1].b1 = 0.0 ;
+
+ affine[1].a00 = 1/6. ; affine[1].a01 = -1/3.*sin(FGH_PI/3.) ; affine[1].a10 = 1/3.*sin(FGH_PI/3.) ; affine[1].a11 = 1/6. ;
+ affine[1].b0 = 1/3. ; affine[1].b1 = 0.0 ;
+
+ affine[2].a00 = 1/6. ; affine[2].a01 = -1/3.*sin(-FGH_PI/3.) ; affine[2].a10 = 1/3.*sin(-FGH_PI/3.) ; affine[2].a11 = 1/6. ;
+ affine[2].b0 = 0.5 ; affine[2].b1 = sqrt(3)/6. ;
+
+ affine[3].a00 = 1/3. ; affine[3].a01 = 0.00 ; affine[3].a10 = 0.00 ; affine[3].a11 = 1/3. ;
+ affine[3].b0 = 2/3. ; affine[3].b1 = 0.0 ;
}
for ( i = 0; i < num_trans; i++ )