Mandlebrot - remove hardware specifics
Mandlebrot - remove hardware specificsugfx_release_2.6
parent
9566e80854
commit
1c5ca344e8
|
@ -23,18 +23,24 @@
|
||||||
#include "gdisp.h"
|
#include "gdisp.h"
|
||||||
|
|
||||||
void mandelbrot(float x1, float y1, float x2, float y2) {
|
void mandelbrot(float x1, float y1, float x2, float y2) {
|
||||||
unsigned int i,j;
|
unsigned int i,j, width, height;
|
||||||
uint16_t iter;
|
uint16_t iter;
|
||||||
color_t color;
|
color_t color;
|
||||||
|
float fwidth, fheight;
|
||||||
|
|
||||||
float sy = y2 - y1;
|
float sy = y2 - y1;
|
||||||
float sx = x2 - x1;
|
float sx = x2 - x1;
|
||||||
const int MAX = 512;
|
const int MAX = 512;
|
||||||
|
|
||||||
for(i = 0; i < 320; i++) {
|
width = (unsigned int)gdispGetWidth();
|
||||||
for(j = 0; j < 240; j++) {
|
height = (unsigned int)gdispGetHeight();
|
||||||
float cy = j * sy / 240.0f + y1;
|
fwidth = width;
|
||||||
float cx = i * sx / 320.0f + x1;
|
fheight = height;
|
||||||
|
|
||||||
|
for(i = 0; i < width; i++) {
|
||||||
|
for(j = 0; j < height; j++) {
|
||||||
|
float cy = j * sy / fheight + y1;
|
||||||
|
float cx = i * sx / fwidth + x1;
|
||||||
float x=0.0f, y=0.0f, xx=0.0f, yy=0.0f;
|
float x=0.0f, y=0.0f, xx=0.0f, yy=0.0f;
|
||||||
for(iter=0; iter <= MAX && xx+yy<4.0f; iter++) {
|
for(iter=0; iter <= MAX && xx+yy<4.0f; iter++) {
|
||||||
xx = x*x;
|
xx = x*x;
|
||||||
|
|
Loading…
Reference in New Issue