Commit cca1cda7 authored by Tom Pastuszek's avatar Tom Pastuszek
Browse files

ZOOOOOM

parent c4cf4478
......@@ -177,10 +177,7 @@ float compute_python(float _z_re, float _z_im, float _c_re, float _c_im, int n){
return n;
}
void fractal(float X1, float Y1, float X2, float Y2, float C_x, float C_y, int n){
int width = 50;
int height = 50;
void fractal(float X1, float Y1, float X2, float Y2, float C_x, float C_y, int n, int width, int height){
float t;
......@@ -210,7 +207,7 @@ void fractal(float X1, float Y1, float X2, float Y2, float C_x, float C_y, int n
//(*video_base)[i][j] = rgb_pack(23,0,0);
}
}
zoom(X1, Y1, X2, Y2, C_x, C_y, n, width, height);
}
......@@ -222,7 +219,7 @@ void selection_reset( int half_x, int half_y, int width, int height, uint16_t re
}
void zoom(float X1, float Y1, float X2, float Y2, int width, int height){
void zoom(float X1, float Y1, float X2, float Y2, float C_x, float C_y, int n, int width, int height){
int half_x = width/2;
int half_y = height/2;
uint16_t red = rgb_pack(31,0,0);
......@@ -251,7 +248,7 @@ void zoom(float X1, float Y1, float X2, float Y2, int width, int height){
selection_reset(half_x, half_y, width, height, red);
while (1){
rgb_knobs_value = *(volatile uint32_t*)(mem_base + SPILED_REG_KNOBS_8BIT_o);
red_knob_val = rgb_knobs_value & 0x00FF0000;
......@@ -289,12 +286,31 @@ void zoom(float X1, float Y1, float X2, float Y2, int width, int height){
}
old_red_stage = red_stage;
if(old_blue_val != blue_val){
print("settttt...", 150, 140, 4, rgb_pack(31, 63, 31));
float d_X = (X2-X1)/2;
float d_Y = (Y2-Y1)/2;
}
switch(red_stage){
case 0:
fractal (X1, Y1 + d_Y, X2 - d_X, Y2, C_x, C_y, n, width, height);
break;
case 1:
fractal (X1 + d_X, Y1 + d_Y, X2, Y2, C_x, C_y, n, width, height);
break;
case 2:
fractal (X1, Y1, X2 - d_X, Y2 - d_Y, C_x, C_y, n, width, height);
break;
case 3:
fractal (X1 + d_X, Y1, X2, Y2 - d_Y, C_x, C_y, n, width, height);
break;
}
break;
}
}
}
\ No newline at end of file
}
\ No newline at end of file
......@@ -6,5 +6,5 @@
float compute(float z_re, float z_im, float c_re, float c_im, int n);
void fractal(float X1, float Y1, float X2, float Y2, float C_x, float C_y, int n);
void zoom(float X1, float Y1, float X2, float Y2, int width, int height);
\ No newline at end of file
void fractal(float X1, float Y1, float X2, float Y2, float C_x, float C_y, int n, int width, int height);
void zoom(float X1, float Y1, float X2, float Y2, float C_x, float C_y, int n, int width, int height);
\ No newline at end of file
No preview for this file type
No preview for this file type
......@@ -206,8 +206,9 @@ int main(int argc, char *argv[])
//memcpy((void*)LCD_FB_START, &tmp_color, LCD_FB_END-LCD_FB_START);
//background_print();
//fractal(-0.5, -0.5, 0.5, 0.5, -15, 15, 17);
zoom(-0.5, -0.5, 0.5, 0.5, 50, 50);
fractal(-2, -2, 2, 2, -15, 15, 17, 50, 50);
//zoom(-2, -2, 2, 2, -15, 15, 17, 50, 50);
draw_menu();
......@@ -403,6 +404,11 @@ int main(int argc, char *argv[])
draw_filled_rect(0, 0, LCD_WIDTH, LCD_HEIGHT, rgb_pack(0,0,0));
if(is_demo){
print("calculating...", 110, 140, 4, rgb_pack(31, 63, 31));
fractal(X1_value, Y1_value, X2_value, Y2_value, C1_value, C2_value, n_value, 50, 50);
/*
print("Demo plecalculated fractal:", 30, 80, 3, rgb_pack(31, 63, 31));
print("X1: -2", 30, 100, 3, rgb_pack(31, 63, 31));
print("Y1: -2", 160, 100, 3, rgb_pack(31, 63, 31));
......@@ -413,10 +419,11 @@ int main(int argc, char *argv[])
print("N: 17", 30, 160, 3, rgb_pack(31, 63, 31));
demo_print();
*/
}
else{
print("calculating...", 110, 140, 4, rgb_pack(31, 63, 31));
fractal(X1_value, Y1_value, X2_value, Y2_value, C1_value, C2_value, n_value);
fractal(X1_value, Y1_value, X2_value, Y2_value, C1_value, C2_value, n_value, LCD_WIDTH, LCD_HEIGHT);
}
updated_values[9] = 0;
}
......
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment