summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--attract.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/attract.c b/attract.c
index 87ca6a1..c4cba5c 100644
--- a/attract.c
+++ b/attract.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
+#include <math.h>
#include <complex.h>
#include <unistd.h>
#include <pthread.h>
@@ -16,19 +17,16 @@ const int MAXITER=200;
const double EPS=1e-1;
static double complex att_func(double complex x,double exponent){
-#if 0
- static const int N=9;
-
- double complex r=1,y=x;
- for(int i=1;i<N;i++){
- r+=y;
- y*=x;
- }
- r+=y;
- return clog(r);
-#else
return clog((1-cpow(x,exponent+1))/(1-x));
-#endif
+
+ // return csqrt(M_SQRT2*x); // sqrt(2) and 0
+ // return csqrt(1+x); // phi
+ // return csqrt(2*x-1); // attracts REALLY SLOWLY to 1+0i
+ // return clog(x); // two basins and two infinities
+ // return clog(x*x); // "241" basins
+ // return clog(x*x+x); // 3 basins but intricate structure
+ // return clog(x*x*x*x+x*x*x+x*x+x+1); // 2 basin fractal?
+ // return csqrt(x*x*x+x*x+x+1);
}
struct colour{
@@ -39,8 +37,9 @@ static struct colour make_colour(double complex z){
static const double N=3;
double norm=cabs(z);
if(norm>N)norm=N;
- int clrv=(int)(norm/N*255);
- return (struct colour){clrv,clrv,clrv};
+ int normclr=(int)(norm/N*255);
+ int argclr=(int)((carg(z)+M_PI)/(2*M_PI)*255);
+ return (struct colour){normclr,argclr,0};
}
struct config{
@@ -116,9 +115,9 @@ static void* thread_entry(void *arg_vp){
}
int main(int argc,char **argv){
- const double minx=-1.5,miny=-1.5;
- const double maxx=1.5,maxy=1.5;
- const double width=500;
+ const double minx=-3,miny=-3;
+ const double maxx=3,maxy=3;
+ const double width=1000;
struct config cfg={
.unitsz=width/(maxx-minx),