diff -urN wf-/data.c wf/data.c --- wf-/data.c 2016-01-03 02:00:00.000000000 +0900 +++ wf/data.c 2016-01-04 00:00:00.000000000 +0900 @@ -28,6 +28,7 @@ CASE_RET(type_point_symmetry); CASE_RET(type_mirror); CASE_RET(type_timeshift); + CASE_RET(type_timeshift_rot); CASE_RET(type_rdiv); CASE_RET(type_slide_way); CASE_RET(type_slide_way_liss); @@ -37,6 +38,7 @@ CASE_RET(type_copy_point_symmetry); CASE_RET(type_copy_mirror); CASE_RET(type_copy_timeshift); + CASE_RET(type_copy_timeshift_rot); CASE_RET(type_test_conv); default: break; } @@ -465,6 +467,15 @@ } static void +op_data_timeshift_rot(struct timeshift_rot *tsr, data_t *data, prm_t *prm) +{ + struct rot rot = { tsr->l, tsr->deg }; + data_t op = { type_rot, &rot }; + prm->sec += tsr->sec; + op_data_draw(&op, data, prm); +} + +static void op_data_rdiv(struct rdiv *rdiv, data_t *data, prm_t *prm) { prm->rdiv = rdiv; @@ -581,6 +592,20 @@ } } +static void +op_data_copy_timeshift_rot(struct copy_timeshift_rot *copy, data_t *data, prm_t *prm) +{ + int i; + struct timeshift_rot tsr = { .sec = copy->init_sec, .l = copy->l, .deg = copy->init_deg }; + data_t op = { type_timeshift_rot, &tsr }; + + for(i=0; in; i++){ + op_data_draw(&op, data,prm); + tsr.sec += copy->step_sec; + tsr.deg += copy->step_deg; + } +} + void op_data_draw(data_t *op, data_t *data, prm_t *prm) { @@ -620,6 +645,9 @@ case type_timeshift: op_data_timeshift(op->p, data, prm); break; + case type_timeshift_rot: + op_data_timeshift_rot(op->p, data, prm); + break; case type_rdiv: op_data_rdiv(op->p, data, prm); break; @@ -652,6 +680,9 @@ case type_copy_timeshift: op_data_copy_timeshift(op->p, data, prm); break; + case type_copy_timeshift_rot: + op_data_copy_timeshift_rot(op->p, data, prm); + break; case type_none: data_draw(data, prm); diff -urN wf-/data.h wf/data.h --- wf-/data.h 2016-01-03 02:00:00.000000000 +0900 +++ wf/data.h 2016-01-04 00:00:00.000000000 +0900 @@ -32,7 +32,8 @@ #define type_point_symmetry 104 #define type_mirror 105 #define type_timeshift 106 -#define type_rdiv 107 +#define type_timeshift_rot 107 +#define type_rdiv 110 #define type_slide_way 120 #define type_slide_way_liss 121 @@ -44,6 +45,7 @@ #define type_copy_point_symmetry 202 #define type_copy_mirror 203 #define type_copy_timeshift 204 +#define type_copy_timeshift_rot 205 #define type_test_conv 254 @@ -106,6 +108,12 @@ d3_t slide; }; +struct timeshift_rot{ + double sec; + line_t l; + double deg; +}; + struct rdiv{ int n; double rate; @@ -135,6 +143,13 @@ d3_t init, step; }; +struct copy_timeshift_rot{ + int n; + double init_sec, step_sec; + line_t l; + double init_deg, step_deg; +}; + typedef struct{ affin_t af; const eye_t *eye; diff -urN wf-/wf_ex.c wf/wf_ex.c --- wf-/wf_ex.c 2016-01-03 02:00:00.000000000 +0900 +++ wf/wf_ex.c 2016-01-04 00:00:00.000000000 +0900 @@ -191,7 +191,15 @@ data_t *cross = &(data_t){ type_op_data_set, &(struct op_data_set){ .op = &(data_t){ type_copy, &(struct copy){ .n = {5*2+1,4*2+1,2*2+1}, .init = {-20*5,-30*4,-40*2}, .step = {20,30,40} }}, - .data = &(data_t){ type_cross, (pos_t[]){{-4,0,0},{4,0,0}} } }}; + .data = &(data_t){ type_slice, &(struct slice){ + .n=6, .ds = (data_t[]){ + { type_cross, (pos_t[]){{-4,0,0},{4,0,0}} }, + { type_none }, + { type_cross, (pos_t[]){{-4,0,0},{4,0,0}} }, + { type_none }, + { type_cross, (pos_t[]){{-4,0,0},{4,0,0}} }, + { type_square } }, + .ts = (double[]){5, 0.05, 0.05, 0.05, 0.5, 5} }} }}; data_t *rcube = &(data_t){ type_op_data_set, &(struct op_data_set){ .op = &(data_t){ type_rdiv_way, &(struct rdiv_way){ @@ -311,8 +319,13 @@ double r = 30; double sky_deg = 40; double sky_sec = 1.966005, pipe_sec = 2, half_sec = (sky_sec + pipe_sec) * 2; - data_t spin = { type_rot_way, &(struct rot_way){ - .l={D3_O,D3_I}, .deg_way=WAY_V2(0,360*4, sky_sec,sky_sec, 3) }}; + + double *spin_vs = (double[]){0, 0, 0, 360*3, 0, 0, 0}; + double *spin_ts = (double[]){sky_sec+pipe_sec*2, 0, sky_sec, sky_sec, 0, pipe_sec*2+sky_sec}; + struct way spin_way = {.n=6,.vs=spin_vs,.ts=spin_ts,.ps=NULL,.dg=3}; + data_t spin1 = { type_rot_way, &(struct rot_way){.l={D3_O,D3_I},.deg_way=spin_way} }; + data_t spin2 = { type_rot_way, &(struct rot_way){.l=LINE_Z,.deg_way=spin_way} }; + data_t spin = { type_arr, (data_t[]){ spin1, spin2, {type_end} }}; data_t *half_pipe = &(data_t){ type_op_data_set, &(struct op_data_set){ .op = &(data_t){ type_zoom_and_slide, (d3_t[]){{0.1,0.1,0.1},{-30,-30,-10}} }, @@ -343,6 +356,34 @@ .data = &(data_t){ type_square } }}, { type_end } }} }}; + data_t *spin_ball = &(data_t){ type_op_data_set, &(struct op_data_set){ + .op = &(data_t){ type_arr, (data_t[]){ + { type_rot_way, &(struct rot_way){.l=LINE_Y,.deg_way=WAY_V2(0,360, 1.3,0, 1) }}, + { type_rot_way, &(struct rot_way){.l=LINE_X,.deg_way=WAY_V2(0,360, 1,0, 1) }}, + { type_end } }}, + .data = &(data_t){ type_circle, &(struct circle){.r=1, .n=3} } }}; + + data_t *fireworks = &(data_t){ type_op_data_set, &(struct op_data_set){ + .op = &(data_t){ type_arr, (data_t[]){ + { type_copy_timeshift_rot, &(struct copy_timeshift_rot){ + .n=6, .init_sec=0, .step_sec=2, .l=LINE_Z, .init_deg=0, .step_deg=360/6 }}, + { type_copy_timeshift, &(struct copy_timeshift){ + .n=3, .init_sec=0, .step_sec=-1, .init={200,0,0}, .step=D3_O }}, + { type_slide_way, &(struct way){ + .n=4, + .ps=(d3_t[]){D3_O,{0,0,100},D3_O, D3_O}, + .ts=(double[]){3+1.5, 1.5+4, 3, 0} }}, + { type_copy_rot, &(struct copy_rot){ + .n=10, .l={D3_O,D3_I}, .init_deg=0, .step_deg=360/10 } }, + { type_copy_rot, &(struct copy_rot){ + .n=10, .l=LINE_Y, .init_deg=0, .step_deg=180.0/10 } }, + { type_slide_way, &(struct way){ + .n=7, + .ps=(d3_t[]){D3_O,D3_O,D3_O,{50,0,0},{50,0,0},D3_O,D3_O}, + .ts=(double[]){3, 0, 3, 4, 0, 3, 0}, .vs=NULL, .dg=3 }}, + { type_end } }}, + .data = spin_ball }}; + data.type = type_arr; data.p = (data_t[]){ *axyz, @@ -351,6 +392,7 @@ *cup, *ferris_wheel, *merry_go_round, *ship, *exile, *lissajours, *half_pipe, + *fireworks, { type_end } }; }