From 116749bc7e14e0585ad09bf91ab63175bbe40bf8 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 13 Feb 2015 13:26:02 +0100 Subject: Drop unused, exported functions --- flam3.c | 351 ---------------------------------------------------------------- 1 file changed, 351 deletions(-) (limited to 'flam3.c') diff --git a/flam3.c b/flam3.c index eb2d2ab..d90b62b 100644 --- a/flam3.c +++ b/flam3.c @@ -86,27 +86,6 @@ unsigned short *flam3_create_xform_distrib(flam3_genome *cp) { return(xform_distrib); } -/* Run this on a copy of a genome to get a strip of the output */ -int flam3_make_strip(flam3_genome *cp, int nstrips, int stripnum) { - - double old_center[2]; - int j; - - /* Strip out motion elements */ - for (j=0;jnum_xforms;j++) - flam3_delete_motion_elements(&cp->xform[j]); - - old_center[0] = cp->center[0]; - old_center[1] = cp->center[1]; - cp->height /= nstrips; - cp->center[1] = cp->center[1] - ((nstrips - 1) * cp->height) / (2 * cp->pixels_per_unit * pow(2.0, cp->zoom)); - cp->center[1] += cp->height * stripnum / ( cp->pixels_per_unit * pow(2.0,cp->zoom) ); - rotate_by(cp->center, old_center, cp->rotate); - - return(0); -} - - void rotate_by(double *p, double *center, double by) { double r[2]; double th = by * 2 * M_PI / 360.0; @@ -262,105 +241,6 @@ int flam3_iterate(flam3_genome *cp, int n, int fuse, const double4 in, double4 * return(badvals); } -#if 0 -int flam3_xform_preview(flam3_genome *cp, int xi, double range, int numvals, int depth, double *result, randctx *rc) { - - /* We will evaluate the 'xi'th xform 'depth' times, over the following values: */ - /* x in [-range : range], y in [-range : range], with 2* (2*numvals+1)^2 values returned */ - double p[4]; - double incr; - int outi; - int xx,yy,dd; - double oldweight; - - outi=0; - - oldweight = cp->xform[xi].density; - cp->xform[xi].density = 1.0; - - /* Prepare the function pointers */ - if (prepare_precalc_flags(cp)) { - cp->xform[xi].density = oldweight; - return(1); - } - - /* Calculate increment */ - incr = range / (double)numvals; - - /* Perform precalculations */ - xform_precalc(cp,xi); - - /* Loop over the grid */ - for (xx=-numvals;xx<=numvals;xx++) { - for (yy=-numvals;yy<=numvals;yy++) { - - /* Calculate the input coordinates */ - p[0] = (double)xx * incr; - p[1] = (double)yy * incr; - - /* Loop over the depth */ - for (dd=0;ddxform[xi].density = oldweight; - - return(0); -} -#endif - -#if 0 -int flam3_colorhist(flam3_genome *cp, int num_batches, randctx *rc, double *hist) { - - int lp,plp; - int mycolor; - unsigned short *xform_distrib; - int sbs = 10000; - double4 *sub_batch; - - sub_batch = malloc (sizeof (*sub_batch) * sbs); - - memset(hist,0,256*sizeof(double)); - - // get into the attractor - if (prepare_precalc_flags(cp)) - return(1); - - xform_distrib = flam3_create_xform_distrib(cp); - - for (lp=0;lpCMAP_SIZE_M1) mycolor=CMAP_SIZE_M1; - - hist[mycolor] += 1; - } - } - - free(xform_distrib); - free(sub_batch); - for (plp=0;plp<256;plp++) - hist[plp] /= (float)(num_batches*sbs); - - return(0); -} -#endif - flam3_genome *sheep_loop(flam3_genome *cp, double blend) { flam3_genome *result; @@ -3433,24 +3313,6 @@ static int sort_by_y(const void *av, const void *bv) { return 0; } - -/* Memory helper functions because - - Python on Windows uses the MSVCR71.dll version of the C Runtime and - mingw uses the MSVCRT.dll version. */ - -void *flam3_malloc(size_t size) { - - return (malloc(size)); - -} - -void flam3_free(void *ptr) { - - free(ptr); - -} - /* * find a 2d bounding box that does not enclose eps of the fractal density * in each compass direction. @@ -3574,11 +3436,6 @@ double flam3_render_memory_required(flam3_frame *spec) (double) cps[0].width * cps[0].height * real_bytes * 9.0; } -void bits_error(flam3_frame *spec) { - fprintf(stderr, "flam3: bits must be 32, 33, or 64 not %d.\n", - spec->bits); -} - int flam3_render(flam3_frame *spec, void *out, int field, int nchan, int trans, stat_struct *stats) { @@ -3601,211 +3458,3 @@ void flam3_srandom() { srandom(seed); } -#if 0 -/* correlation dimension, after clint sprott. - computes slope of the correlation sum at a size scale - the order of 2% the size of the attractor or the camera. */ -double flam3_dimension(flam3_genome *cp, int ntries, int clip_to_camera) { - double fd; - double *hist; - double bmin[2]; - double bmax[2]; - double d2max; - int lp; - randctx rc; - int SBS = 10000; - int i, n1=0, n2=0, got, nclipped; - - xorshift_seed (&rc); - - if (ntries < 2) ntries = 3000*1000; - - if (clip_to_camera) { - double scale, ppux, corner0, corner1; - scale = pow(2.0, cp->zoom); - ppux = cp->pixels_per_unit * scale; - corner0 = cp->center[0] - cp->width / ppux / 2.0; - corner1 = cp->center[1] - cp->height / ppux / 2.0; - bmin[0] = corner0; - bmin[1] = corner1; - bmax[0] = corner0 + cp->width / ppux; - bmax[1] = corner1 + cp->height / ppux; - } else { - if (flam3_estimate_bounding_box(cp, 0.0, 0, bmin, bmax, &rc)<0) - return(-1.0); - - } - - d2max = - (bmax[0] - bmin[0]) * (bmax[0] - bmin[0]) + - (bmax[1] - bmin[1]) * (bmax[1] - bmin[1]); - - // fprintf(stderr, "d2max=%g %g %g %g %g\n", d2max, - // bmin[0], bmin[1], bmax[0], bmax[1]); - - hist = malloc(2 * ntries * sizeof(double)); - - got = 0; - nclipped = 0; - double4 *subb = malloc (sizeof (*subb) * SBS); - while (got < 2*ntries) { - int i4, clipped; - unsigned short *xform_distrib; - const double4 start = (double4) { flam3_random_isaac_11(&rc), flam3_random_isaac_11(&rc), 0.0, 0.0 }; - if (prepare_precalc_flags(cp)) - return(-1.0); - xform_distrib = flam3_create_xform_distrib(cp); - if (xform_distrib==NULL) - return(-1.0); - flam3_iterate(cp, SBS, 20, start, subb, xform_distrib, &rc); - free(xform_distrib); - i4 = 0; - for (i = 0; i < SBS; i++) { - if (got == 2*ntries) break; - clipped = clip_to_camera && - ((subb[i4] < bmin[0]) || - (subb[i4+1] < bmin[1]) || - (subb[i4] > bmax[0]) || - (subb[i4+1] > bmax[1])); - if (!clipped) { - hist[got] = subb[i4]; - hist[got+1] = subb[i4+1]; - got += 2; - } else { - nclipped++; - if (nclipped > 10 * ntries) { - fprintf(stderr, "warning: too much clipping, " - "flam3_dimension giving up.\n"); - free (subb); - return sqrt(-1.0); - } - } - i4 += 4; - } - } - free (subb); - if (0) - fprintf(stderr, "cliprate=%g\n", nclipped/(ntries+(double)nclipped)); - - for (i = 0; i < ntries; i++) { - int ri; - double dx, dy, d2; - double tx, ty; - - tx = hist[2*i]; - ty = hist[2*i+1]; - - do { - ri = 2 * (random() % ntries); - } while (ri == i); - - dx = hist[ri] - tx; - dy = hist[ri+1] - ty; - d2 = dx*dx + dy*dy; - if (d2 < 0.004 * d2max) n2++; - if (d2 < 0.00004 * d2max) n1++; - } - - fd = 0.434294 * log(n2 / (n1 - 0.5)); - - if (0) - fprintf(stderr, "n1=%d n2=%d\n", n1, n2); - - free(hist); - return fd; -} -#endif - -#if 0 -double flam3_lyapunov(flam3_genome *cp, int ntries) { - double p[4]; - double x, y; - double xn, yn; - double xn2, yn2; - double dx, dy, r; - double eps = 1e-5; - int i; - double sum = 0.0; - unsigned short *xform_distrib; - - int lp; - randctx rc; - - xorshift_seed (&rc); - - if (ntries < 1) ntries = 10000; - - for (i = 0; i < ntries; i++) { - x = flam3_random_isaac_11(&rc); - y = flam3_random_isaac_11(&rc); - - p[0] = x; - p[1] = y; - p[2] = 0.0; - p[3] = 0.0; - - // get into the attractor - if (prepare_precalc_flags(cp)) - return(-1.0); - xform_distrib = flam3_create_xform_distrib(cp); - if (xform_distrib==NULL) - return(-1.0); - - flam3_iterate(cp, 1, 20+(random()%10), p, xform_distrib, &rc); - free(xform_distrib); - - x = p[0]; - y = p[1]; - - // take one deterministic step - srandom(i); - - if (prepare_precalc_flags(cp)) - return(-1.0); - xform_distrib = flam3_create_xform_distrib(cp); - if (xform_distrib==NULL) - return(-1.0); - - flam3_iterate(cp, 1, 0, p, xform_distrib, &rc); - free(xform_distrib); - - xn = p[0]; - yn = p[1]; - - do { - dx = flam3_random_isaac_11(&rc); - dy = flam3_random_isaac_11(&rc); - r = sqrt(dx * dx + dy * dy); - } while (r == 0.0); - dx /= r; - dy /= r; - - dx *= eps; - dy *= eps; - - p[0] = x + dx; - p[1] = y + dy; - p[2] = 0.0; - - // take the same step but with eps - srandom(i); - if (prepare_precalc_flags(cp)) - return(-1.0); - xform_distrib = flam3_create_xform_distrib(cp); - if (xform_distrib==NULL) - return(-1.0); - - flam3_iterate(cp, 1, 0, p, xform_distrib, &rc); - free(xform_distrib); - - xn2 = p[0]; - yn2 = p[1]; - - r = sqrt((xn-xn2)*(xn-xn2) + (yn-yn2)*(yn-yn2)); - - sum += log(r/eps); - } - return sum/(log(2.0)*ntries); -} -#endif - -- cgit v1.2.3