ADMIN: migration complete

git-svn-id: https://svn.code.sf.net/p/apophysis7x/svn/trunk@1 a5d1c0f9-a0e9-45c6-87dd-9d276e40c949
This commit is contained in:
xyrus02
2013-07-28 08:58:33 +00:00
commit 95a2f54683
258 changed files with 175238 additions and 0 deletions

89
Plugin/barycentroid.c Normal file
View File

@ -0,0 +1,89 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double barycentroid_a, barycentroid_b, barycentroid_c, barycentroid_d;
double a, b, c, d;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("barycentroid");
APO_VARIABLES(
VAR_REAL(barycentroid_a, 1.0),
VAR_REAL(barycentroid_b, 0.0),
VAR_REAL(barycentroid_c, 0.0),
VAR_REAL(barycentroid_d, 1.0)
);
int PluginVarPrepare(Variation* vp)
{
// alias
VAR(a) = VAR(barycentroid_a);
VAR(b) = VAR(barycentroid_b);
VAR(c) = VAR(barycentroid_c);
VAR(d) = VAR(barycentroid_d);
return TRUE;
}
inline double sgn(double v) { return v < 0 ? -1 : v > 0 ? 1 : 0; }
int PluginVarCalc(Variation* vp)
{
// helpers
/* The code is supposed to be fast and you all can read it so I dont
create those aliases for readability in actual code:
v0x = VAR(a)
v0y = VAR(b)
v1x = VAR(c)
v1y = VAR(d)
v2x = FTx
v2y = FTy
*/
// compute dot products
double dot00 = VAR(a) * VAR(a) + VAR(b) * VAR(b); // v0 * v0
double dot01 = VAR(a) * VAR(c) + VAR(b) * VAR(d); // v0 * v1
double dot02 = VAR(a) * FTx + VAR(b) * FTy; // v0 * v2
double dot11 = VAR(c) * VAR(c) + VAR(d) * VAR(d); // v1 * v1
double dot12 = VAR(c) * FTx + VAR(d) * FTy; // v1 * v2
// compute inverse denomiator
double invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
/* now we can pull [u,v] as the barycentric coordinates of the point
P in the triangle [A, B, C]
*/
double u = (dot11 * dot02 - dot01 * dot12) * invDenom;
double v = (dot00 * dot12 - dot01 * dot02) * invDenom;
// now combine with input
double um = sqrt(sqr(u) + sqr(FTx)) * sgn(u);
double vm = sqrt(sqr(v) + sqr(FTy)) * sgn(v);
FPx += VVAR * um;
FPy += VVAR * vm;
FPz += VVAR * FTz; // just pass
return TRUE;
}

65
Plugin/bcircle.c Normal file
View File

@ -0,0 +1,65 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double bcbw;
double bcircle_scale;
double bcircle_borderwidth;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("bcircle");
APO_VARIABLES(
VAR_REAL(bcircle_scale, 1.0),
VAR_REAL(bcircle_borderwidth, 0.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(bcbw) = fabs(VAR(bcircle_borderwidth));
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
if ((FTx == 0) && (FTy == 0)) {
return TRUE;
}
double x = FTx * VAR(bcircle_scale);
double y = FTy * VAR(bcircle_scale);
double r = sqrt(x * x + y * y);
if (r <= 1) {
FPx += VVAR * x;
FPy += VVAR * y;
} else {
if (VAR(bcbw) != 0) {
double ang = atan2(y, x);
double omega = (0.2 * VAR(bcbw) * random01()) + 1;
double px = omega * cos(ang);
double py = omega * sin(ang);
FPx += VVAR * px;
FPy += VVAR * py;
}
}
return TRUE;
}

67
Plugin/bent2.c Normal file
View File

@ -0,0 +1,67 @@
/*
Apophysis Plugin
Copyright (C) 2008-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double bent2_x;
double bent2_y;
double vvarx;
double vvary;
//double bipilar_vvar;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("bent2");
// Define the Variables
APO_VARIABLES(
VAR_REAL(bent2_x, 1.0),
VAR_REAL(bent2_y, 1.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(vvarx) = VVAR * VAR(bent2_x);
VAR(vvary) = VVAR * VAR(bent2_y);
//VAR(bipolar_vvar) = 1
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
if(FTx >= 0.0)
FPx += VVAR * FTx;
else
FPx += VAR(vvarx) * FTx;
if(FTy >= 0.0)
FPy += VVAR * FTy;
else
FPy += VAR(vvary) * FTy;
return TRUE;
}

58
Plugin/blur_linear.c Normal file
View File

@ -0,0 +1,58 @@
/*
Apophysis Plugin
Copyright (C) 2009 Joel Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double blur_linear_length;
double blur_linear_angle;
double s;
double c;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("blur_linear");
// Define the Variables
APO_VARIABLES(
VAR_REAL(blur_linear_length, 0.0),
VAR_REAL_CYCLE(blur_linear_angle, 0.0, M_2PI, 0.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
fsincos(VAR(blur_linear_angle), &VAR(s), &VAR(c));
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double r = VAR(blur_linear_length) * random01();
FPx += VVAR * (FTx + r * VAR(c));
FPy += VVAR * (FTy + r * VAR(s));
return TRUE;
}

53
Plugin/blur_square.c Normal file
View File

@ -0,0 +1,53 @@
/*
Apophysis Plugin
Copyright (C) 2009 Joel Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double v;
} Variables;
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#define APO_VIRTUALVAR
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("blur_square");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(v) = VVAR * 2.0;
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
FPx += VAR(v) * (random01() - 0.5);
FPy += VAR(v) * (random01() - 0.5);
return TRUE;
}

104
Plugin/boarders2.c Normal file
View File

@ -0,0 +1,104 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double boarders2_c;
double boarders2_left;
double boarders2_right;
double c, cl, cr;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("boarders2");
APO_VARIABLES(
VAR_REAL(boarders2_c, 0.5),
VAR_REAL(boarders2_left, 0.5),
VAR_REAL(boarders2_right, 0.5),
);
inline double rint(double x)
{
int temp; temp = (x >= 0. ? (int)(x + 0.5) : (int)(x - 0.5));
return (double)temp;
}
int PluginVarPrepare(Variation* vp)
{
double c = fabs(VAR(boarders2_c)),
cl = fabs(VAR(boarders2_left)),
cr = fabs(VAR(boarders2_right));
c = c==0?EPS:c; cl = cl==0?EPS:cl; cr = cr==0?EPS:cr;
VAR(c) = c; VAR(cl) = c*cl; VAR(cr) = c+(c*cr);
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
const double c = vp->var.c;
const double cl = vp->var.cl;
const double cr = vp->var.cr;
double roundX, roundY, offsetX, offsetY;
roundX = rint(FTx);
roundY = rint(FTy);
offsetX = FTx - roundX;
offsetY = FTy - roundY;
if(random01() >= cr)
{
FPx += VVAR*(offsetX*c + roundX);
FPy += VVAR*(offsetY*c + roundY);
}
else
{
if(fabs(offsetX) >= fabs(offsetY))
{
if(offsetX >= 0.0)
{
FPx += VVAR*(offsetX*c + roundX + cl);
FPy += VVAR*(offsetY*c + roundY + cl * offsetY / offsetX);
}
else
{
FPx += VVAR*(offsetX*c + roundX - cl);
FPy += VVAR*(offsetY*c + roundY - cl * offsetY / offsetX);
}
}
else
{
if(offsetY >= 0.0)
{
FPy += VVAR*(offsetY*c + roundY + cl);
FPx += VVAR*(offsetX*c + roundX + offsetX/offsetY*cl);
}
else
{
FPy += VVAR*(offsetY*c + roundY - cl);
FPx += VVAR*(offsetX*c + roundX - offsetX/offsetY*cl);
}
}
}
return TRUE;
}

54
Plugin/butterfly.c Normal file
View File

@ -0,0 +1,54 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double v;
} Variables;
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#define APO_VIRTUALVAR
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("butterfly");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(v) = VVAR * 4.0 / sqrt(3.0 * M_PI);
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double y2 = FTy * 2.0;
double r = VAR(v) * sqrt(fabs(FTy * FTx)/(EPS + sqr(FTx) + sqr(y2)));
FPx += r * FTx;
FPy += r * y2;
return TRUE;
}

52
Plugin/cardiod.c Normal file
View File

@ -0,0 +1,52 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double cardioid_a;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("cardioid");
// Define the Variables
APO_VARIABLES(
VAR_REAL(cardioid_a, 1.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double a = atan2(FTy, FTx);
double r = VVAR * sqrt(sqr(FTx) + sqr(FTy) + sin( a * VAR(cardioid_a)) + 1.0 );
double s, c;
fsincos( a, &s, &c);
FPx += r * c;
FPy += r * s;
return TRUE;
}

92
Plugin/cell.c Normal file
View File

@ -0,0 +1,92 @@
/*
Apophysis Plugin
Copyright (c) 2008 Joel Faber. All rights reserverd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double cell_size;
double inv_cell_size;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("cell");
// Define the Variables
APO_VARIABLES(
VAR_REAL(cell_size, 1.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
if (VAR(cell_size) == 0) VAR(cell_size) = 1e-6;
VAR(inv_cell_size) = 1.0 / VAR(cell_size);
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
// calculate input cell
int x = floor(FTx*VAR(inv_cell_size));
int y = floor(FTy*VAR(inv_cell_size));
// Offset from cell origin
double dx = FTx - x*VAR(cell_size);
double dy = FTy - y*VAR(cell_size);
// interleave cells
if (y >= 0)
{
if (x >= 0)
{
y *= 2;
x *= 2;
}
else
{
y *= 2;
x = -(2*x+1);
}
}
else
{
if (x >= 0)
{
y = -(2*y+1);
x *= 2;
}
else
{
y = -(2*y+1);
x = -(2*x+1);
}
}
// calculate output point from interleaved cell
FPx += VVAR * (dx + x*VAR(cell_size));
FPy -= VVAR * (dy + y*VAR(cell_size));
return TRUE;
}

101
Plugin/checks.c Normal file
View File

@ -0,0 +1,101 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double checks_x;
double checks_y;
double checks_size;
double checks_rnd;
double cs, cx, cy, ncx, ncy;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("checks");
// Define the Variables
APO_VARIABLES(
VAR_REAL(checks_x, 0.5),
VAR_REAL(checks_y, 0.5),
VAR_REAL(checks_size, 0.5),
VAR_REAL(checks_rnd, 0.0)
);
inline double lrint(double x)
{
long int temp; temp = (x >= 0. ? (long int)(x + 0.5) : (long int)(x - 0.5));
return (double)temp;
}
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
// Multiplication is faster than division, so divide in precalc, multiply in calc.
VAR(cs) = 1.0 / (VAR(checks_size) + EPS);
// -X- Copied the variables as we only need them for reading
// This is just for safety :-)
VAR(cx) = VAR(checks_x); VAR(cy) = VAR(checks_y);
// -X- Then precalculate -checkx_x, -checks_y
VAR(ncx) = VAR(checks_x) * -1.0; VAR(ncy) = VAR(checks_y) * -1.0;
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double dx, dy;
double x = FTx * VAR(cs);
double y = FTy * VAR(cs);
int isXY = lrint(FTx * VAR(cs)) +
lrint(FTy * VAR(cs));
// -X- This is just for code readability,
// if there is any impact on performance, its minimal :-)
double rnx = VAR(checks_rnd) * random01();
double rny = VAR(checks_rnd) * random01();
if (isXY % 2)
{
// -X- The -VAR(checks_#) stuff caused the error!
dx = VAR(ncx) + rnx;
dy = VAR(ncy);
}
else
{
dx = VAR(cx);
dy = VAR(cy) + rny;
}
FPx += VVAR * (FTx + dx);
FPy += VVAR * (FTy + dy);
// -X- and as a little goodie, I pass through FTz so that
// neat lil variation does not kill 3Dness in hack & 7X
FPz += VVAR * (FTz);
return TRUE;
}

93
Plugin/circlize.c Normal file
View File

@ -0,0 +1,93 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double circlize_hole;
double VVAR4_PI;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("circlize");
// Define the Variables
APO_VARIABLES(
VAR_REAL(circlize_hole, 0.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(VVAR4_PI) = VVAR / M_PI_4;
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double absx = fabs(FTx);
double absy = fabs(FTy);
double side;
double perimeter;
double r, sina, cosa;
if (absx >= absy)
{
if (FTx >= absy)
{
perimeter = absx + FTy;
}
else
{
perimeter = 5.0 * absx - FTy;
}
side = absx;
}
else
{
if (FTy >= absx)
{
perimeter = 3.0 * absy - FTx;
}
else
{
perimeter = 7.0 * absy + FTx;
}
side = absy;
}
// tsk tsk... hole is not scaled by vvar.
r = VAR(VVAR4_PI) * side + VAR(circlize_hole);
fsincos(M_PI_4 * perimeter / side - M_PI_4, &sina, &cosa);
FPx += r * cosa;
FPy += r * sina;
return TRUE;
}

75
Plugin/coswrap.c Normal file
View File

@ -0,0 +1,75 @@
/*
"Cosine Wrap" plugin for Apophysis 2.x
Copyright (C) 2010 Georg Kiehne
Apophysis Fractal Flame Renderer
Copyright (C) 2001-2004 Mark Townsend
Copyright (C) 2005-2008 Peter Sdobnov, Piotr Borys, Ronald Hordijk
flame - cosmic recursive fractal flames
Copyright (C) 1992-2007 Scott Draves
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
int coswrap_repeat;
double coswrap_amount_x, coswrap_amount_y;
double coswrap_phase_x, coswrap_phase_y;
double ax, ay, px, py, axn, ayn, fr, vv2;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
APO_PLUGIN("coswrap");
APO_VARIABLES(
VAR_INTEGER_NONZERO(coswrap_repeat, 1.0),
VAR_REAL(coswrap_amount_x, 0.0),
VAR_REAL(coswrap_amount_y, 0.0),
VAR_REAL_CYCLE(coswrap_phase_x, -1.0, 1.0, 0.0),
VAR_REAL_CYCLE(coswrap_phase_y, -1.0, 1.0, 0.0)
);
// why isn't this in apoplugin.h??
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int PluginVarPrepare(Variation* vp)
{
VAR(ax) = M_2PI * fabs(VAR(coswrap_amount_x));
VAR(ay) = M_2PI * fabs(VAR(coswrap_amount_y));
VAR(px) = M_PI * VAR(coswrap_phase_x);
VAR(py) = M_PI * VAR(coswrap_phase_y);
VAR(fr) = fabs((double)VAR(coswrap_repeat));
VAR(vv2)= 2.0 * VVAR;
return TRUE;
}
inline double flerp(double a, double b, double p) { return (a+(b-a)*p); }
inline double fabsmod(double fintp) { double dummy; return modf(fintp, &dummy); }
inline double fosc(double p, double amp, double ph) { return 0.5-cos(p*amp+ph)*0.5; }
inline double foscn(double p, double ph) { return 0.5-cos(p+ph)*0.5; }
int PluginVarCalc(Variation* vp)
{
double x = 0.5 * FTx + 0.5, y = 0.5 * FTy + 0.5;
double bx = fabsmod(VAR(fr) * x), by = fabsmod(VAR(fr) * y);
double oscnapx = foscn(VAR(coswrap_amount_x), VAR(px)),
oscnapy = foscn(VAR(coswrap_amount_y), VAR(py));
FPx = -1.0 + VAR(vv2) * flerp(flerp(x, fosc(x, 4.0, VAR(px)), oscnapx), fosc(bx, 4.0, VAR(px)), oscnapx);
FPy = -1.0 + VAR(vv2) * flerp(flerp(y, fosc(y, 4.0, VAR(py)), oscnapy), fosc(by, 4.0, VAR(py)), oscnapy);
return TRUE;
}

79
Plugin/cpow.c Normal file
View File

@ -0,0 +1,79 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double cpow_r;
double cpow_i;
int cpow_power;
double c;
double d;
double ang;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("cpow");
// Define the Variables
APO_VARIABLES(
VAR_REAL(cpow_r, 1.0),
VAR_REAL(cpow_i, 0.0),
VAR_INTEGER_NONZERO(cpow_power, 1)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(ang) = 2.0 * M_PI / ((double) VAR(cpow_power));
VAR(c) = VAR(cpow_r) / ((double) VAR(cpow_power));
VAR(d) = VAR(cpow_i) / ((double) VAR(cpow_power));
return TRUE; // Always return TRUE.
}
/*
z' = z^(cpow_r + i * cpow_i)
Simplified using formula:
(a + i*b)^(c + i*d) = rho^c * e^(-d * theta) * [cos(c * theta + d * ln(rho) + i * sin(c * theta + d * ln(rho)],
where (rho, theta) is the polar coordinate equivalent of z=(x, y).
*/
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double sn, cs;
double a = atan2(FTy, FTx); // Angular polar dimension
double lnr = 0.5 * log(FTx*FTx + FTy*FTy); // Natural logarithm of the radial polar dimension.
double m = VVAR * exp(VAR(c) * lnr - VAR(d) * a);
fsincos(VAR(c) * a + VAR(d) * lnr + VAR(ang) * (rand() % VAR(cpow_power)), &sn, &cs);
FPx += m * cs;
FPy += m * sn;
return TRUE;
}

84
Plugin/cpow2.c Normal file
View File

@ -0,0 +1,84 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double cpow2_r, cpow2_a;
int cpow2_divisor;
int cpow2_spread;
double c, half_c;
double d, half_d;
double ang;
double inv_spread, full_spread;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("cpow2");
// Define the Variables
APO_VARIABLES(
VAR_REAL(cpow2_r, 1.0),
VAR_REAL(cpow2_a, 0.0),
VAR_INTEGER_NONZERO(cpow2_divisor, 1),
VAR_INTEGER_RANGE(cpow2_spread, 1, 0x7fffffff, 1),
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(ang) = 2*M_PI / ((double) VAR(cpow2_divisor));
VAR(c) = VAR(cpow2_r) * cos(M_PI/2*VAR(cpow2_a)) / ((double) VAR(cpow2_divisor));
VAR(d) = VAR(cpow2_r) * sin(M_PI/2*VAR(cpow2_a)) / ((double) VAR(cpow2_divisor));
VAR(half_c) = VAR(c) / 2;
VAR(half_d) = VAR(d) / 2;
VAR(inv_spread) = 0.5 / VAR(cpow2_spread);
VAR(full_spread) = 2*M_PI*VAR(cpow2_spread);
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double sn, cs;
double a = atan2(FTy, FTx);
int n = rand() % VAR(cpow2_spread);
if (a < 0) n++;
a += 2*M_PI*n;
if (cos(a*VAR(inv_spread)) < rand()*2.0/RAND_MAX - 1.0)
a -= VAR(full_spread);
double lnr2 = log(FTx*FTx + FTy*FTy); // logarithm * 2
double r = VVAR * exp(VAR(half_c) * lnr2 - VAR(d) * a);
fsincos(VAR(c) * a + VAR(half_d) * lnr2 + VAR(ang) * rand(),
&sn, &cs);
FPx += r * cs;
FPy += r * sn;
return TRUE;
}

762
Plugin/crackle.c Normal file
View File

@ -0,0 +1,762 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// "Crackle" variation is a type of blur - it is not affected by incoming data, simply
// generates a texture.
// These set cache size for cell centres, they take a lot of processing, so it's handy to
// keep values between calls
#define _USE_MATH_DEFINES
#define CACHE_NUM 10
#define CACHE_WIDTH 21
#define VORONOI_MAXPOINTS 25
// voronoi and noiseb are additional, not required in all Apophysis plugins
#define _x_ 0
#define _y_ 1
#define _z_ 2
double vratio( double P[2], double Q[2], double U[2] );
int closest( double P[VORONOI_MAXPOINTS][2], int n, double U[2] );
double voronoi( double P[VORONOI_MAXPOINTS][2], int n, int q, double U[2] );
double simplexNoise3D( double V[3] );
double perlinNoise3D( double V[3], double aScale, double fScale, int octaves );
// Must define this structure before we include apoplugin.h
typedef struct
{
double crackle_cellsize;
double crackle_power;
double crackle_distort;
double crackle_scale;
double crackle_z;
// P is a working list of points
double P[VORONOI_MAXPOINTS][2];
// C is a cache of pre-calculated centres
double C[CACHE_WIDTH][CACHE_WIDTH][2];
} Variables;
#include "apoplugin.h"
static int p[2050] = {
127, 71, 882, 898, 798, 463, 517, 451, 454, 634, 578, 695, 728, 742, 325, 350, 684, 153, 340,
311, 992, 706, 218, 285, 96, 486, 160, 98, 686, 288, 193, 119, 410, 246, 536, 415, 953, 417,
784, 573, 734, 1, 136, 381, 177, 678, 773, 22, 301, 51, 874, 844, 775, 744, 633, 468, 1019,
287, 475, 78, 294, 724, 519, 17, 323, 191, 187, 446, 262, 212, 170, 33, 7, 227, 566, 526, 264,
556, 717, 477, 815, 671, 225, 207, 692, 663, 969, 393, 658, 877, 353, 788, 128, 303, 614, 501,
490, 387, 53, 941, 951, 736, 539, 102, 163, 175, 584, 988, 35, 347, 442, 649, 642, 198, 727,
939, 913, 811, 894, 858, 181, 412, 307, 830, 154, 479, 704, 326, 681, 619, 698, 621, 552, 598,
74, 890, 299, 922, 701, 481, 867, 214, 817, 731, 768, 673, 315, 338, 576, 222, 484, 305, 623,
239, 269, 46, 748, 608, 546, 537, 125, 667, 998, 714, 529, 823, 247, 289, 771, 808, 973, 735,
516, 974, 702, 636, 357, 455, 600, 80, 336, 696, 963, 297, 92, 980, 670, 958, 625, 712, 406,
173, 19, 763, 470, 793, 283, 655, 59, 421, 1016, 219, 13, 105, 840, 111, 38, 408, 945, 242,
559, 206, 443, 331, 737, 580, 767, 1020, 220, 31, 968, 15, 527, 833, 139, 129, 859, 739, 418,
783, 933, 49, 789, 178, 124, 772, 627, 0, 23, 388, 950, 976, 940, 485, 685, 21, 523, 723, 244,
637, 488, 835, 379, 342, 452, 862, 295, 765, 897, 507, 370, 567, 416, 100, 914, 300, 120, 392,
694, 94, 265, 791, 171, 200, 787, 441, 868, 672, 769, 983, 911, 427, 82, 69, 224, 176, 920,
500, 462, 263, 513, 797, 293, 322, 645, 469, 635, 40, 215, 687, 960, 818, 826, 34, 603, 316,
994, 611, 511, 93, 899, 114, 73, 241, 585, 327, 674, 280, 957, 471, 24, 502, 355, 159, 1017,
855, 270, 538, 521, 162, 880, 334, 986, 740, 719, 266, 820, 97, 41, 52, 750, 893, 838, 616, 83,
896, 777, 464, 562, 183, 362, 411, 478, 398, 384, 912, 599, 587, 609, 822, 243, 504, 753, 857,
157, 964, 65, 261, 81, 371, 435, 924, 885, 884, 863, 613, 721, 669, 121, 639, 989, 487, 238,
448, 216, 852, 643, 713, 676, 277, 879, 133, 123, 304, 547, 396, 70, 141, 909, 848, 900, 318,
146, 356, 802, 4, 807, 558, 764, 545, 588, 872, 554, 467, 544, 505, 149, 62, 901, 64, 45, 813,
27, 109, 718, 803, 853, 996, 1014, 476, 575, 28, 199, 688, 6, 482, 703, 560, 395, 66, 341, 794,
422, 376, 601, 76, 14, 569, 480, 39, 1011, 1001, 854, 55, 89, 335, 761, 363, 419, 252, 799,
358, 324, 1012, 152, 312, 496, 235, 916, 582, 615, 979, 1005, 891, 1013, 641, 18, 148, 185,
512, 378, 58, 211, 495, 594, 87, 762, 366, 660, 449, 520, 424, 886, 819, 281, 147, 290, 390,
32, 572, 993, 720, 683, 309, 254, 607, 568, 256, 533, 394, 620, 429, 67, 831, 103, 423, 668,
693, 518, 551, 697, 253, 949, 54, 875, 116, 434, 743, 644, 590, 279, 843, 589, 11, 647, 586,
806, 549, 375, 226, 851, 499, 450, 978, 29, 982, 189, 107, 508, 373, 796, 20, 700, 110, 26,
461, 782, 591, 828, 57, 904, 847, 328, 122, 630, 711, 44, 397, 404, 209, 365, 84, 194, 1021,
675, 135, 965, 329, 557, 691, 79, 352, 498, 629, 869, 90, 921, 233, 622, 871, 755, 439, 955,
228, 63, 825, 43, 943, 438, 144, 961, 359, 330, 682, 626, 425, 259, 249, 801, 754, 1003, 230,
377, 217, 878, 1007, 313, 2, 915, 550, 271, 437, 846, 548, 145, 715, 346, 251, 372, 99, 543,
16, 47, 195, 679, 174, 905, 188, 804, 169, 785, 231, 726, 814, 339, 531, 420, 258, 1009, 134,
972, 458, 234, 690, 260, 666, 646, 142, 184, 91, 628, 987, 10, 210, 926, 348, 386, 161, 60,
409, 680, 204, 164, 444, 708, 276, 68, 383, 491, 382, 42, 816, 483, 699, 150, 9, 565, 555, 433,
593, 86, 952, 839, 618, 751, 889, 108, 361, 595, 677, 407, 856, 255, 604, 85, 648, 928, 824,
213, 192, 267, 902, 792, 656, 631, 403, 389, 493, 333, 756, 602, 925, 113, 632, 354, 37, 873,
577, 56, 278, 930, 367, 428, 332, 317, 530, 364, 800, 774, 497, 1023, 12, 137, 845, 653, 101,
888, 542, 167, 48, 158, 1002, 745, 292, 944, 456, 990, 574, 25, 1018, 937, 298, 966, 430, 400,
349, 860, 689, 320, 117, 778, 104, 314, 786, 205, 606, 440, 936, 457, 932, 934, 948, 168, 445,
931, 757, 291, 571, 919, 360, 284, 509, 296, 245, 836, 166, 3, 257, 50, 282, 151, 810, 344,
947, 236, 946, 865, 752, 77, 610, 967, 795, 131, 302, 760, 781, 190, 938, 61, 1022, 652, 138,
984, 832, 202, 140, 985, 5, 657, 997, 401, 319, 431, 662, 405, 275, 650, 651, 887, 310, 1004,
368, 208, 596, 248, 758, 8, 126, 730, 489, 343, 337, 506, 515, 432, 232, 250, 532, 954, 524,
115, 229, 522, 908, 729, 186, 561, 995, 156, 196, 118, 805, 399, 918, 991, 849, 273, 747, 640,
143, 321, 624, 268, 306, 30, 722, 540, 534, 710, 130, 155, 883, 716, 525, 426, 812, 345, 929,
975, 472, 837, 605, 664, 391, 581, 272, 746, 112, 659, 665, 780, 240, 841, 474, 563, 36, 579,
286, 436, 907, 369, 201, 402, 962, 106, 749, 172, 494, 88, 466, 473, 414, 597, 374, 942, 308,
766, 459, 821, 592, 881, 380, 759, 866, 779, 809, 876, 541, 829, 528, 999, 221, 661, 927, 413,
977, 182, 583, 733, 892, 741, 570, 351, 617, 956, 72, 709, 850, 732, 770, 870, 95, 935, 223,
179, 861, 917, 447, 385, 132, 827, 923, 75, 465, 612, 460, 725, 492, 553, 1008, 910, 981, 503,
165, 895, 834, 1000, 180, 638, 906, 510, 274, 776, 971, 564, 738, 903, 654, 864, 959, 1015,
453, 535, 237, 197, 1006, 790, 514, 842, 970, 705, 707, 1010, 203,
// 1k Block repeats here
127, 71, 882, 898, 798, 463, 517, 451, 454, 634, 578, 695, 728, 742, 325, 350, 684, 153, 340,
311, 992, 706, 218, 285, 96, 486, 160, 98, 686, 288, 193, 119, 410, 246, 536, 415, 953, 417,
784, 573, 734, 1, 136, 381, 177, 678, 773, 22, 301, 51, 874, 844, 775, 744, 633, 468, 1019,
287, 475, 78, 294, 724, 519, 17, 323, 191, 187, 446, 262, 212, 170, 33, 7, 227, 566, 526, 264,
556, 717, 477, 815, 671, 225, 207, 692, 663, 969, 393, 658, 877, 353, 788, 128, 303, 614, 501,
490, 387, 53, 941, 951, 736, 539, 102, 163, 175, 584, 988, 35, 347, 442, 649, 642, 198, 727,
939, 913, 811, 894, 858, 181, 412, 307, 830, 154, 479, 704, 326, 681, 619, 698, 621, 552, 598,
74, 890, 299, 922, 701, 481, 867, 214, 817, 731, 768, 673, 315, 338, 576, 222, 484, 305, 623,
239, 269, 46, 748, 608, 546, 537, 125, 667, 998, 714, 529, 823, 247, 289, 771, 808, 973, 735,
516, 974, 702, 636, 357, 455, 600, 80, 336, 696, 963, 297, 92, 980, 670, 958, 625, 712, 406,
173, 19, 763, 470, 793, 283, 655, 59, 421, 1016, 219, 13, 105, 840, 111, 38, 408, 945, 242,
559, 206, 443, 331, 737, 580, 767, 1020, 220, 31, 968, 15, 527, 833, 139, 129, 859, 739, 418,
783, 933, 49, 789, 178, 124, 772, 627, 0, 23, 388, 950, 976, 940, 485, 685, 21, 523, 723, 244,
637, 488, 835, 379, 342, 452, 862, 295, 765, 897, 507, 370, 567, 416, 100, 914, 300, 120, 392,
694, 94, 265, 791, 171, 200, 787, 441, 868, 672, 769, 983, 911, 427, 82, 69, 224, 176, 920,
500, 462, 263, 513, 797, 293, 322, 645, 469, 635, 40, 215, 687, 960, 818, 826, 34, 603, 316,
994, 611, 511, 93, 899, 114, 73, 241, 585, 327, 674, 280, 957, 471, 24, 502, 355, 159, 1017,
855, 270, 538, 521, 162, 880, 334, 986, 740, 719, 266, 820, 97, 41, 52, 750, 893, 838, 616, 83,
896, 777, 464, 562, 183, 362, 411, 478, 398, 384, 912, 599, 587, 609, 822, 243, 504, 753, 857,
157, 964, 65, 261, 81, 371, 435, 924, 885, 884, 863, 613, 721, 669, 121, 639, 989, 487, 238,
448, 216, 852, 643, 713, 676, 277, 879, 133, 123, 304, 547, 396, 70, 141, 909, 848, 900, 318,
146, 356, 802, 4, 807, 558, 764, 545, 588, 872, 554, 467, 544, 505, 149, 62, 901, 64, 45, 813,
27, 109, 718, 803, 853, 996, 1014, 476, 575, 28, 199, 688, 6, 482, 703, 560, 395, 66, 341, 794,
422, 376, 601, 76, 14, 569, 480, 39, 1011, 1001, 854, 55, 89, 335, 761, 363, 419, 252, 799,
358, 324, 1012, 152, 312, 496, 235, 916, 582, 615, 979, 1005, 891, 1013, 641, 18, 148, 185,
512, 378, 58, 211, 495, 594, 87, 762, 366, 660, 449, 520, 424, 886, 819, 281, 147, 290, 390,
32, 572, 993, 720, 683, 309, 254, 607, 568, 256, 533, 394, 620, 429, 67, 831, 103, 423, 668,
693, 518, 551, 697, 253, 949, 54, 875, 116, 434, 743, 644, 590, 279, 843, 589, 11, 647, 586,
806, 549, 375, 226, 851, 499, 450, 978, 29, 982, 189, 107, 508, 373, 796, 20, 700, 110, 26,
461, 782, 591, 828, 57, 904, 847, 328, 122, 630, 711, 44, 397, 404, 209, 365, 84, 194, 1021,
675, 135, 965, 329, 557, 691, 79, 352, 498, 629, 869, 90, 921, 233, 622, 871, 755, 439, 955,
228, 63, 825, 43, 943, 438, 144, 961, 359, 330, 682, 626, 425, 259, 249, 801, 754, 1003, 230,
377, 217, 878, 1007, 313, 2, 915, 550, 271, 437, 846, 548, 145, 715, 346, 251, 372, 99, 543,
16, 47, 195, 679, 174, 905, 188, 804, 169, 785, 231, 726, 814, 339, 531, 420, 258, 1009, 134,
972, 458, 234, 690, 260, 666, 646, 142, 184, 91, 628, 987, 10, 210, 926, 348, 386, 161, 60,
409, 680, 204, 164, 444, 708, 276, 68, 383, 491, 382, 42, 816, 483, 699, 150, 9, 565, 555, 433,
593, 86, 952, 839, 618, 751, 889, 108, 361, 595, 677, 407, 856, 255, 604, 85, 648, 928, 824,
213, 192, 267, 902, 792, 656, 631, 403, 389, 493, 333, 756, 602, 925, 113, 632, 354, 37, 873,
577, 56, 278, 930, 367, 428, 332, 317, 530, 364, 800, 774, 497, 1023, 12, 137, 845, 653, 101,
888, 542, 167, 48, 158, 1002, 745, 292, 944, 456, 990, 574, 25, 1018, 937, 298, 966, 430, 400,
349, 860, 689, 320, 117, 778, 104, 314, 786, 205, 606, 440, 936, 457, 932, 934, 948, 168, 445,
931, 757, 291, 571, 919, 360, 284, 509, 296, 245, 836, 166, 3, 257, 50, 282, 151, 810, 344,
947, 236, 946, 865, 752, 77, 610, 967, 795, 131, 302, 760, 781, 190, 938, 61, 1022, 652, 138,
984, 832, 202, 140, 985, 5, 657, 997, 401, 319, 431, 662, 405, 275, 650, 651, 887, 310, 1004,
368, 208, 596, 248, 758, 8, 126, 730, 489, 343, 337, 506, 515, 432, 232, 250, 532, 954, 524,
115, 229, 522, 908, 729, 186, 561, 995, 156, 196, 118, 805, 399, 918, 991, 849, 273, 747, 640,
143, 321, 624, 268, 306, 30, 722, 540, 534, 710, 130, 155, 883, 716, 525, 426, 812, 345, 929,
975, 472, 837, 605, 664, 391, 581, 272, 746, 112, 659, 665, 780, 240, 841, 474, 563, 36, 579,
286, 436, 907, 369, 201, 402, 962, 106, 749, 172, 494, 88, 466, 473, 414, 597, 374, 942, 308,
766, 459, 821, 592, 881, 380, 759, 866, 779, 809, 876, 541, 829, 528, 999, 221, 661, 927, 413,
977, 182, 583, 733, 892, 741, 570, 351, 617, 956, 72, 709, 850, 732, 770, 870, 95, 935, 223,
179, 861, 917, 447, 385, 132, 827, 923, 75, 465, 612, 460, 725, 492, 553, 1008, 910, 981, 503,
165, 895, 834, 1000, 180, 638, 906, 510, 274, 776, 971, 564, 738, 903, 654, 864, 959, 1015,
453, 535, 237, 197, 1006, 790, 514, 842, 970, 705, 707, 1010, 203,
// 2k block overlaps by two items here . . . (to allow for over-runs caused by taking
// "next item in sequence")
127, 71
};
// grad[][] contains gradient values that will be associated with grid points for
// the simplex code to interpolate. They are chosen using the hash codes
// from p[], above
static double grad3[1024][3] = {
{0.79148875, 0.11986299, -0.59931496}, {0.51387411, -0.61170974, 0.60145208}, {-0.95395128, -0.21599571, 0.20814132}, {0.59830026, 0.67281067, 0.43515813},
{-0.93971346, 0.16019818, -0.30211777}, {-0.74549699, -0.35758846, 0.56246309}, {-0.78850321, -0.29060783, 0.54204223}, {0.61332339, 0.38915256, 0.68730976},
{-0.64370632, -0.40843865, 0.64716307}, {-0.23922684, 0.70399949, -0.66869667}, {-0.82882802, -0.00130741, 0.55950192}, {0.07987672, 0.62439350, -0.77701510},
{-0.46863456, -0.57517073, 0.67049257}, {0.30792870, 0.42464616, -0.85138449}, {-0.06972001, 0.30439513, 0.94999091}, {0.58798450, -0.00151777, 0.80887077},
{-0.32757867, 0.51578941, 0.79161449}, {-0.44745031, 0.86883688, 0.21192142}, {-0.38042636, 0.71222019, 0.58993066}, {-0.32616370, 0.61421101, -0.71858339},
{0.45483340, 0.19928843, -0.86799234}, {-0.81020233, -0.05930352, 0.58314259}, {0.81994145, 0.39825895, 0.41120046}, {0.49257662, 0.74240487, 0.45409612},
{0.95124863, -0.26667257, -0.15495734}, {-0.95745656, 0.09203090, -0.27350914}, {0.20842499, -0.82482150, -0.52557446}, {0.46829293, -0.47740985, -0.74349282},
{-0.65000311, -0.74754355, 0.13665502}, {0.83566743, 0.53294928, -0.13275921}, {0.90454761, -0.35449497, -0.23691126}, {-0.64270969, 0.21532175, 0.73522839},
{-0.39693478, -0.17553935, -0.90090439}, {0.45073049, 0.65155528, 0.61017845}, {0.69618384, -0.07989842, 0.71340333}, {0.09059934, 0.85274641, -0.51440773},
{-0.00560267, 0.69197466, 0.72190005}, {0.23586856, -0.95830502, 0.16129945}, {0.20354340, -0.96925430, -0.13826128}, {-0.45516395, 0.63885905, 0.62022970},
{0.80792021, 0.47917579, 0.34300946}, {0.40886670, -0.32579857, -0.85245722}, {-0.83819701, -0.30910810, 0.44930831}, {-0.57602641, -0.75801200, 0.30595978},
{-0.16591524, -0.96579983, -0.19925569}, {0.27174061, 0.93638167, -0.22214053}, {-0.45758922, 0.73185326, -0.50497812}, {-0.18029934, -0.78067110, -0.59836843},
{0.14087163, -0.39189764, -0.90915974}, {-0.03534787, -0.02750024, 0.99899663}, {0.91016878, 0.06772570, 0.40866370}, {0.70142578, 0.70903193, 0.07263332},
{-0.49486157, -0.54111502, -0.67993129}, {-0.26972486, -0.84418773, -0.46324462}, {0.91931005, 0.03121901, 0.39229378}, {-0.15332070, -0.87495538, 0.45928842},
{-0.59010107, -0.66883868, 0.45214549}, {0.51964273, -0.78565398, -0.33573688}, {-0.25845001, 0.87348329, -0.41259003}, {-0.64741807, -0.59846669, 0.47189773},
{-0.79348688, -0.32782128, -0.51274923}, {-0.86280237, -0.14342378, -0.48476972}, {0.19469709, -0.76349966, 0.61576076}, {0.39371236, -0.70742193, -0.58697938},
{0.62103834, -0.50000004, -0.60358209}, {-0.19652824, -0.51508695, 0.83430335}, {-0.96016549, -0.26826630, -0.07820118}, {0.52655683, 0.84118729, 0.12305219},
{0.56222101, 0.70557745, -0.43135599}, {0.06395307, 0.99025162, -0.12374061}, {-0.65379289, 0.52521996, 0.54470070}, {0.81206590, -0.38643765, 0.43728128},
{-0.69449067, -0.71926243, -0.01855435}, {0.33968533, 0.75504287, 0.56082452}, {-0.52402654, -0.70537870, -0.47732282}, {-0.65379327, -0.46369816, 0.59794512},
{-0.08582021, -0.01217948, 0.99623619}, {-0.66287577, 0.49604924, 0.56083051}, {0.70911302, 0.68748287, -0.15660789}, {-0.58662137, -0.46475685, 0.66323181},
{-0.76681755, 0.63310950, -0.10565607}, {0.68601816, -0.59353001, 0.42083395}, {0.64792478, -0.72668696, 0.22829704}, {0.68756542, -0.69062543, 0.22425499},
{-0.46901797, -0.72307343, -0.50713604}, {-0.71418521, -0.11738817, 0.69004312}, {0.50880449, -0.80611081, 0.30216445}, {0.27793962, -0.58372922, -0.76289565},
{-0.39417207, 0.91575060, -0.07764800}, {-0.84724113, -0.47860304, 0.23048124}, {0.67628991, 0.54362408, -0.49709638}, {0.65073821, -0.09420630, 0.75343544},
{0.66910202, 0.73566783, -0.10533437}, {0.72191995, -0.00305613, 0.69196983}, {-0.00313125, 0.06634333, 0.99779194}, {-0.06908811, 0.28990653, -0.95455803},
{0.17507626, 0.73870621, 0.65089280}, {-0.57470594, 0.75735703, 0.31003777}, {-0.91870733, 0.08883536, 0.38481830}, {-0.27399536, 0.39846316, 0.87530203},
{0.99772699, -0.05473919, 0.03929993}, {0.22663907, 0.97393801, -0.00891541}, {0.62338001, 0.59656797, -0.50547405}, {0.59177247, 0.49473684, -0.63642816},
{-0.24457664, -0.31345545, 0.91756632}, {-0.44691491, -0.89198404, -0.06805539}, {-0.83115967, -0.44685014, 0.33090566}, {-0.39940345, 0.67719937, -0.61796270},
{0.55460272, -0.63265953, -0.54051619}, {0.82284412, 0.14794174, -0.54867185}, {-0.39887172, -0.82890906, -0.39218761}, {0.28591109, 0.71270085, 0.64055628},
{-0.15438831, 0.66966606, 0.72643762}, {-0.75134796, 0.54289699, 0.37515211}, {0.32016243, 0.77691605, -0.54212311}, {0.50884942, 0.15171482, -0.84738119},
{0.08945627, 0.73684807, 0.67011379}, {-0.68792851, -0.71885270, -0.10002580}, {0.02292266, -0.07249674, 0.99710520}, {0.94083723, -0.10191422, 0.32316993},
{-0.81053204, 0.43703808, 0.38991733}, {-0.19558496, -0.07485841, 0.97782552}, {0.68911052, -0.49915226, -0.52533200}, {0.19796974, 0.93342057, 0.29922235},
{-0.79540501, -0.26473293, 0.54520395}, {-0.27945416, -0.91288360, 0.29757168}, {0.82074194, 0.43648314, 0.36859889}, {-0.20594999, -0.70696486, -0.67659832},
{-0.05687654, -0.70968577, 0.70221874}, {-0.26280466, 0.69993747, -0.66409430}, {-0.54551347, -0.78469719, 0.29438983}, {0.90609571, 0.39319111, 0.15617717},
{0.69129692, 0.67317351, 0.26257571}, {0.98391565, -0.05206160, 0.17087883}, {0.63806303, 0.67740288, -0.36606134}, {-0.50096077, 0.83542684, -0.22605378},
{0.65237128, 0.35509583, 0.66956603}, {-0.85711882, -0.19885856, 0.47518691}, {0.79383271, -0.12451513, 0.59525256}, {-0.63301076, 0.07907192, 0.77009416},
{0.57925311, -0.49077742, 0.65084818}, {0.14070842, 0.97298117, 0.18305403}, {-0.59601232, 0.69646383, -0.39963413}, {-0.68205637, -0.47455943, 0.55641033},
{0.47997775, -0.84805982, -0.22453484}, {0.83562547, -0.48273957, 0.26209270}, {0.59180830, 0.36411758, 0.71915320}, {0.66057023, -0.66033264, 0.35722231},
{0.53319130, 0.75511965, 0.38144639}, {-0.21631797, -0.12712992, 0.96801060}, {-0.23971441, 0.89928294, -0.36582400}, {-0.72825564, 0.27377922, -0.62824252},
{0.02135570, 0.73882696, 0.67355672}, {0.48112026, 0.78759215, 0.38499597}, {-0.58250985, -0.09956878, 0.80670213}, {0.21323385, 0.36856735, 0.90481459},
{-0.36459960, -0.93062781, -0.03160697}, {-0.68684541, 0.17314748, -0.70587771}, {0.68032531, -0.07909205, -0.72863017}, {0.25007484, -0.61882132, 0.74466284},
{0.77055613, 0.59380162, 0.23160935}, {0.67996118, -0.03835970, 0.73224403}, {0.43079959, 0.38901749, -0.81429547}, {0.76815116, -0.63831184, 0.05001794},
{-0.13601015, 0.75596033, -0.64033211}, {0.36884321, -0.45188838, -0.81225093}, {0.79562623, -0.43647179, 0.42008485}, {-0.65875496, 0.39126701, -0.64261344},
{-0.68899899, 0.44217527, 0.57424858}, {0.25292617, 0.96620732, -0.04971687}, {-0.68558843, -0.70460233, 0.18304118}, {0.86382379, 0.29507865, 0.40833448},
{0.13627838, 0.31500179, 0.93925613}, {0.67187940, 0.64336667, 0.36695693}, {0.37977583, 0.31123423, 0.87115072}, {-0.03326050, -0.99451574, -0.09915731},
{-0.66427749, -0.01424397, -0.74735033}, {0.68859558, 0.44744486, -0.57063931}, {-0.56738045, 0.30154774, -0.76625608}, {-0.58488004, 0.63357146, 0.50646080},
{0.38842469, 0.92016339, 0.04925032}, {0.15316057, -0.97495961, -0.16123153}, {0.57623375, 0.51659393, 0.63331301}, {0.32392581, -0.79816566, -0.50794059},
{0.73136440, -0.54179646, 0.41420129}, {-0.58929886, -0.58690534, -0.55521975}, {0.64030162, 0.32487137, -0.69604054}, {0.80502987, -0.00635101, 0.59320028},
{0.46595373, 0.62005710, -0.63120227}, {0.83612498, 0.53677947, 0.11297261}, {-0.60753284, -0.29028728, -0.73934913}, {-0.45583848, 0.84488003, 0.27998037},
{-0.27320563, -0.39709327, 0.87617100}, {0.84893256, -0.09000823, 0.52078021}, {-0.35708766, -0.73203774, 0.58018027}, {0.10507148, -0.71032871, 0.69598355},
{0.68468508, 0.26788814, -0.67782172}, {-0.94602428, -0.13594737, -0.29420466}, {0.27104088, 0.95431757, 0.12575696}, {-0.55840113, 0.14909310, 0.81606337},
{0.47553129, 0.80729730, 0.34948685}, {-0.01891509, -0.97526220, 0.22024047}, {-0.65760518, -0.45924250, -0.59720327}, {-0.70549425, 0.70862555, 0.01129989},
{-0.88864223, 0.43707946, -0.13883994}, {0.49252849, -0.43814774, 0.75195894}, {-0.01398277, 0.69598571, 0.71791947}, {-0.67265622, 0.27228276, -0.68803758},
{-0.91724038, -0.01083918, -0.39818663}, {-0.24468025, 0.75690032, 0.60599792}, {-0.49070434, -0.48530058, 0.72366608}, {0.67110346, -0.55453760, -0.49204492},
{-0.95532877, -0.26328211, -0.13427388}, {-0.66012945, 0.41730904, 0.62456567}, {0.96822786, -0.03273592, 0.24791766}, {0.91952853, 0.23575545, -0.31446248},
{0.63712542, 0.06762652, 0.76778763}, {-0.21680947, 0.65843559, 0.72073312}, {0.06143588, 0.47272235, -0.87906724}, {0.70541616, -0.21884659, 0.67416186},
{-0.04396589, -0.67487644, -0.73661984}, {-0.65032618, 0.75012744, 0.11993615}, {-0.78840054, 0.58187068, -0.19962741}, {0.99318416, 0.11467779, 0.02083796},
{0.76775820, 0.46845611, -0.43714554}, {-0.70891635, -0.54302381, -0.45006972}, {0.55548849, -0.71825576, -0.41897638}, {-0.62167600, 0.77500231, 0.11353575},
{0.38413022, -0.79687865, 0.46629218}, {-0.56271512, 0.54186596, -0.62428597}, {0.62019121, -0.70563211, -0.34270424}, {0.85913131, 0.50529005, 0.08108862},
{0.54973106, -0.66129569, -0.51037612}, {-0.74254469, -0.49670185, -0.44934914}, {-0.75780366, 0.59195518, -0.27444976}, {-0.40050287, 0.04302113, -0.91528500},
{-0.60859484, 0.35063171, 0.71180736}, {-0.57297537, 0.81938865, -0.01736289}, {0.98721933, 0.09373543, -0.12888621}, {0.30397213, 0.87942861, 0.36634172},
{0.32615126, -0.64515144, -0.69094498}, {0.83015604, 0.30783918, 0.46483974}, {0.42822875, -0.04288671, -0.90265213}, {0.16585965, 0.53714643, 0.82702133},
{-0.37193298, 0.88497229, 0.28016051}, {0.73544877, 0.67744273, 0.01365471}, {-0.66150496, 0.09327263, -0.74411787}, {0.41664753, -0.23786298, -0.87739731},
{-0.78513086, -0.42653313, 0.44904233}, {0.08029855, 0.84803303, 0.52382451}, {-0.09507221, 0.50524394, -0.85772364}, {0.66939507, -0.17805679, 0.72125309},
{-0.76923153, 0.41652205, -0.48455364}, {0.51989556, 0.79632686, 0.30914743}, {0.85617969, -0.51024476, 0.08128121}, {0.71830013, 0.03208003, 0.69499337},
{-0.96000528, -0.11640072, -0.25463844}, {0.66084196, -0.19355993, 0.72513617}, {-0.57661819, -0.54757438, 0.60636109}, {0.65123443, -0.64818909, -0.39464494},
{0.36952748, -0.22540306, -0.90146708}, {0.34048182, -0.33515083, 0.87849078}, {0.11132435, -0.75280467, 0.64876191}, {0.67563520, 0.64934616, -0.34909404},
{0.23316576, 0.69276343, -0.68243135}, {0.30368064, -0.87532007, 0.37628825}, {-0.27080673, -0.74246398, 0.61270789}, {-0.21655683, -0.49565083, -0.84109060},
{-0.98776592, -0.14473189, 0.05806181}, {0.64562720, 0.38598860, 0.65892209}, {-0.63746045, -0.57205546, 0.51613635}, {0.06117405, -0.78423981, -0.61743474},
{0.74829362, 0.59119862, 0.30090006}, {-0.42571462, 0.51302568, -0.74536683}, {-0.56331794, 0.48608227, -0.66812943}, {-0.75919788, -0.64885422, 0.05105673},
{0.14385006, -0.53933953, 0.82971081}, {-0.77031548, -0.28344830, 0.57120148}, {-0.98358057, 0.17900745, 0.02292584}, {-0.25051205, 0.10358351, 0.96255606},
{-0.32867861, -0.83176115, -0.44737430}, {-0.36281449, -0.92995082, -0.05964161}, {-0.53796595, -0.03614791, 0.84219117}, {0.92960703, 0.10461247, 0.35339354},
{0.64021850, 0.61360003, 0.46218532}, {0.22343529, 0.69409296, 0.68433299}, {0.01781074, 0.89088149, 0.45388648}, {-0.63004672, -0.26934609, 0.72835007},
{0.48560056, -0.35192051, -0.80021500}, {0.62050161, 0.57366872, 0.53467931}, {0.00265452, 0.71539198, -0.69871830}, {0.64229521, 0.41380752, 0.64515130},
{0.23080049, -0.43573115, 0.86998247}, {0.14620517, 0.61171896, -0.77744708}, {-0.27436021, -0.61900378, 0.73590814}, {0.69959023, 0.71050058, 0.07591065},
{0.70362024, 0.62044755, -0.34635731}, {-0.29622242, -0.71700405, -0.63099721}, {0.31094340, -0.84299864, -0.43893905}, {0.07704196, -0.46344069, -0.88277248},
{-0.94533514, -0.04418570, 0.32309301}, {0.65845027, -0.36172634, -0.65999795}, {0.76069300, -0.18013255, 0.62361721}, {0.18607691, -0.45751624, -0.86951382},
{-0.67626808, -0.39178398, -0.62383235}, {-0.58782719, 0.55645189, -0.58721418}, {0.37531624, 0.80640206, 0.45700485}, {0.32610790, -0.50457786, 0.79940905},
{0.62915643, 0.76094546, -0.15850616}, {0.62803678, -0.75273385, -0.19738681}, {0.42539119, -0.89094420, 0.15893638}, {0.17668676, -0.40626331, 0.89651096},
{0.02778178, -0.78957083, -0.61303024}, {-0.25950053, -0.16244258, 0.95198313}, {-0.44117714, 0.73727502, -0.51165249}, {-0.30827444, 0.94136275, 0.13712420},
{0.97572111, -0.04258044, -0.21483768}, {0.55607688, 0.60474525, -0.57014181}, {-0.67430479, 0.12532345, 0.72774109}, {-0.31325824, -0.81393777, -0.48925921},
{-0.34811982, -0.70956566, 0.61264114}, {0.22583632, 0.72502572, -0.65064250}, {0.76936493, 0.63742123, -0.04209247}, {-0.55303394, -0.38417341, -0.73929984},
{-0.20953448, -0.92686077, -0.31148742}, {-0.18786352, 0.39920999, 0.89740664}, {0.46307517, -0.88470611, 0.05344618}, {-0.70328479, 0.30353783, 0.64284935},
{0.85916171, 0.15710234, 0.48699077}, {-0.26398391, 0.42122173, 0.86768932}, {0.82468427, 0.55134621, 0.12614757}, {0.05993298, 0.63414584, 0.77088721},
{-0.57291678, 0.81909656, -0.02910645}, {0.64075141, 0.74416542, -0.18882655}, {0.67112660, -0.55747979, -0.48867716}, {0.89932863, 0.23426637, -0.36922525},
{0.59146340, -0.44386974, 0.67316469}, {0.46684506, 0.19781570, -0.86193076}, {0.18536399, 0.76259887, 0.61974443}, {0.84144446, -0.53500771, -0.07574940},
{0.31212800, 0.82898453, -0.46406977}, {-0.88440729, -0.27020677, -0.38054178}, {0.20051055, 0.77523319, 0.59900670}, {0.48749115, 0.44082691, -0.75367368},
{0.24971103, -0.88242146, 0.39871892}, {-0.29777449, -0.95158243, -0.07629705}, {-0.37776905, -0.58777023, 0.71541366}, {0.22179317, 0.14730715, -0.96390269},
{0.58348153, 0.68630504, 0.43420582}, {-0.96759942, 0.14572096, 0.20619593}, {-0.15181654, 0.47495708, 0.86681458}, {0.26580537, 0.74350537, -0.61363447},
{-0.39189499, 0.72950601, 0.56057051}, {-0.01888074, 0.73557245, -0.67718290}, {0.73486517, 0.20569655, -0.64626783}, {-0.26354754, -0.23595215, -0.93534447},
{-0.62584298, -0.65116585, 0.42930594}, {-0.66666701, 0.61406968, 0.42246127}, {0.71799877, 0.67101619, 0.18497305}, {0.80098282, -0.45681211, -0.38697444},
{0.13205975, 0.91574792, -0.37942847}, {0.68891728, 0.72389791, -0.03694308}, {0.50346408, 0.46323331, -0.72934136}, {0.84557323, 0.53378861, -0.00869685},
{0.08666773, -0.81879883, 0.56750082}, {-0.50044423, 0.65858460, -0.56198033}, {0.35669785, 0.32248792, -0.87679427}, {-0.97346629, -0.22237373, -0.05397509},
{-0.53358835, -0.29312069, -0.79332448}, {0.12615748, 0.47083230, 0.87315591}, {-0.97022570, 0.19065350, 0.14937651}, {-0.57777643, 0.36008023, 0.73247295},
{0.60132454, 0.72398065, 0.33802488}, {0.19047827, -0.94729649, -0.25757988}, {-0.45904437, 0.69100108, 0.55838676}, {0.39148612, -0.51878308, 0.76000180},
{0.04137949, -0.75662546, -0.65253786}, {0.20020542, -0.76439245, -0.61288006}, {0.07933739, -0.21074410, 0.97431643}, {-0.40807425, 0.80614533, 0.42849166},
{-0.95397962, -0.09342040, -0.28494828}, {-0.31365384, 0.14377778, -0.93858895}, {0.84618575, -0.39191761, 0.36106822}, {-0.90177404, 0.07825801, -0.42506385},
{-0.19689944, -0.97296956, 0.12066831}, {0.61145370, 0.51715369, -0.59889601}, {-0.57329050, -0.80450317, -0.15528251}, {-0.27749150, -0.76245284, 0.58452044},
{-0.74877628, 0.66124357, 0.04572758}, {0.60284514, 0.58208119, 0.54567318}, {0.17695878, -0.67360184, 0.71759748}, {-0.83953853, 0.41240184, 0.35369447},
{0.37802442, -0.60322405, 0.70229501}, {0.51050450, -0.42970396, 0.74480847}, {-0.48366785, -0.20902730, -0.84992529}, {-0.87971286, -0.14820690, -0.45181855},
{-0.11520437, -0.59044778, -0.79881123}, {0.38877393, 0.92116844, -0.01742240}, {0.94330646, -0.27385756, -0.18754989}, {-0.66585548, 0.46928680, -0.58000550},
{0.20659390, -0.97226278, -0.10965425}, {0.70114934, 0.70875543, -0.07781609}, {0.50683262, 0.81003447, 0.29489803}, {-0.75501572, 0.56485827, -0.33299610},
{-0.43930454, -0.48824131, 0.75407688}, {-0.43442626, 0.51174617, 0.74120826}, {-0.97139119, -0.22722375, 0.06905442}, {-0.27189670, 0.51890879, -0.81043559},
{0.34109465, 0.91412005, -0.21917797}, {0.23216825, -0.66497033, 0.70986785}, {0.87281521, 0.48669099, 0.03640737}, {-0.60266004, -0.34235001, -0.72083101},
{-0.01994494, -0.52747354, 0.84933731}, {-0.27000504, -0.77679344, -0.56893693}, {-0.12330809, 0.85744248, -0.49958734}, {-0.69270982, 0.61145042, -0.38246763},
{-0.60277814, 0.55015465, 0.57791727}, {0.64946165, -0.22132925, -0.72747023}, {0.24257305, 0.26557728, 0.93307397}, {-0.66814908, 0.64881591, -0.36416303},
{-0.74538727, -0.44634982, -0.49514609}, {0.25115903, 0.38535072, -0.88793241}, {-0.61584597, -0.69782826, -0.36574509}, {0.13745929, 0.92666227, 0.34985995},
{-0.50342245, -0.82980249, -0.24081874}, {0.11249648, 0.99333196, -0.02522230}, {0.83241096, 0.21922825, -0.50895085}, {0.50175590, 0.86108612, 0.08229039},
{-0.35527286, -0.56925625, -0.74143679}, {0.31441654, -0.91653449, 0.24719782}, {0.62936968, 0.70222610, 0.33282475}, {0.77755375, -0.56236234, -0.28135169},
{-0.80098254, -0.37712493, 0.46497715}, {0.59310190, -0.68181911, -0.42819720}, {0.15392285, -0.98282954, 0.10175390}, {-0.96618662, 0.25781497, 0.00385483},
{0.33750940, -0.86020836, 0.38226820}, {-0.09597976, -0.40348179, -0.90993974}, {-0.70910783, 0.60681107, -0.35909108}, {0.41726791, -0.90380775, 0.09496860},
{-0.03646000, 0.99581799, -0.08376873}, {0.35348135, -0.70899268, 0.61022972}, {0.66002017, 0.74115740, -0.12271547}, {0.18515044, 0.96534454, -0.18392727},
{-0.29364182, -0.88826809, -0.35320572}, {0.99692330, 0.02436644, -0.07449968}, {-0.13529570, 0.35908874, 0.92344483}, {-0.76888326, -0.29702475, 0.56621095},
{-0.31931644, 0.72859881, 0.60595444}, {0.52827199, -0.82385659, 0.20539968}, {-0.83281688, -0.27413556, 0.48090097}, {-0.76899198, 0.23377782, 0.59497837},
{-0.60599231, 0.54438401, -0.58001670}, {-0.59616975, -0.18605791, 0.78100198}, {-0.83753036, 0.32458912, -0.43952794}, {0.62016934, 0.71285793, 0.32745011},
{-0.62489231, 0.01790151, 0.78050570}, {-0.44050813, -0.31396367, 0.84105850}, {0.82831903, 0.51349534, 0.22407615}, {-0.54638365, -0.42878084, -0.71945250},
{-0.30690837, -0.54588407, -0.77962673}, {-0.51419246, 0.49668914, 0.69921814}, {0.12759508, 0.79794754, 0.58906640}, {0.59812622, 0.53597438, 0.59579904},
{0.75450428, 0.31026344, 0.57832507}, {-0.34806954, -0.09710281, 0.93242621}, {-0.40140375, -0.85287390, 0.33388792}, {0.57290191, 0.32347021, -0.75309390},
{-0.53362688, -0.81285892, 0.23345818}, {-0.74679447, 0.64927639, 0.14400758}, {-0.80251380, -0.59638095, 0.01736004}, {-0.56868668, 0.61763086, -0.54325646},
{-0.72976559, 0.04179896, -0.68241852}, {0.57244144, -0.09255805, -0.81470474}, {0.97741613, 0.07186077, -0.19873032}, {0.72298477, 0.06613486, 0.68769121},
{-0.42596585, -0.65375247, -0.62542850}, {0.64840687, 0.16136696, -0.74399545}, {0.34352050, -0.92950264, 0.13423304}, {0.74687236, 0.45351768, -0.48631613},
{-0.51873425, -0.73762481, -0.43223191}, {0.29790392, 0.44209023, 0.84605525}, {-0.67740274, 0.46717430, -0.56821977}, {-0.36224935, -0.42773177, 0.82814307},
{-0.44192484, 0.73919980, 0.50821855}, {-0.92680658, -0.18163204, -0.32869343}, {-0.71384582, -0.70014113, 0.01505111}, {0.70600729, -0.70152253, 0.09705589},
{0.90031692, -0.36943663, 0.23010002}, {0.25264659, -0.65121757, -0.71560141}, {0.96727807, 0.19056552, 0.16750499}, {-0.65770755, -0.65887301, 0.36511251},
{0.05208955, -0.10417910, 0.99319353}, {-0.65282932, -0.40832320, 0.63803294}, {-0.00628739, -0.99502463, -0.09943061}, {-0.51900794, -0.62993523, 0.57776497},
{0.83046729, -0.16527060, 0.53198657}, {0.66869945, -0.56606479, -0.48209097}, {-0.54299772, -0.48639669, -0.68452300}, {0.52407156, -0.42268239, 0.73938393},
{0.71446999, -0.30844019, -0.62801057}, {-0.67320882, 0.39978543, 0.62206228}, {-0.53289859, -0.05079670, -0.84465306}, {0.67708925, -0.71979254, 0.15313018},
{-0.61369683, 0.65230332, 0.44483321}, {-0.26453665, -0.69129417, -0.67240816}, {0.85045794, 0.03075140, 0.52514345}, {-0.76757885, -0.10940324, 0.63154861},
{0.72754104, -0.17450402, -0.66350011}, {-0.34075755, -0.67303082, 0.65644026}, {0.70044829, 0.13095479, -0.70158609}, {0.43950040, -0.88211196, 0.16946353},
{-0.35706397, 0.48041126, 0.80106825}, {-0.77687193, 0.33320308, -0.53427120}, {0.51274543, 0.77662232, 0.36599165}, {0.33380578, 0.79591657, 0.50506486},
{-0.76587225, -0.03670574, 0.64194422}, {-0.23491078, 0.43695339, -0.86826762}, {0.25698923, -0.62346599, 0.73840822}, {0.13009757, -0.93331414, -0.33466303},
{-0.54841950, 0.64297666, -0.53461861}, {0.69823865, 0.51710521, -0.49504039}, {-0.64058874, -0.76638614, -0.04794108}, {-0.99383538, 0.10829476, 0.02373760},
{0.53702674, -0.26620457, -0.80046075}, {0.95618706, 0.14762618, 0.25280983}, {0.46882627, -0.32353926, -0.82190284}, {0.37771393, -0.17580406, -0.90907927},
{-0.38046162, 0.14393199, -0.91352752}, {0.99319923, -0.09757638, -0.06351493}, {0.50851715, 0.83898531, 0.19368521}, {0.32506349, -0.66811447, 0.66929574},
{-0.48035988, -0.63636898, -0.60356351}, {-0.06435942, 0.26733173, 0.96145286}, {0.60598929, -0.04278909, 0.79432114}, {-0.24869997, 0.88809619, -0.38656626},
{0.37370464, 0.04464997, -0.92647246}, {-0.48971589, -0.59472073, 0.63756224}, {0.69752714, 0.12358938, 0.70581978}, {0.52787180, 0.64468756, -0.55292794},
{-0.10489693, 0.16880171, -0.98005235}, {-0.63336451, -0.45121552, -0.62869226}, {0.54866356, 0.65678858, 0.51729785}, {-0.85968969, 0.49557488, -0.12385145},
{-0.47320716, -0.15150042, 0.86782637}, {0.19900943, -0.10259966, 0.97461200}, {-0.52893938, 0.84740153, 0.04619294}, {0.65121421, -0.49243156, -0.57743503},
{0.45693424, 0.73751862, 0.49726994}, {-0.47661222, -0.77374319, -0.41732752}, {-0.04808540, 0.90050093, 0.43218730}, {0.91129978, -0.31013948, 0.27082507},
{0.58778939, -0.42668247, -0.68734686}, {0.82297839, -0.34772114, -0.44921773}, {0.29494223, -0.86544442, -0.40498769}, {-0.39161493, 0.79055212, 0.47081322},
{0.79434783, -0.59398096, -0.12727195}, {0.77174313, 0.29796481, 0.56180915}, {0.78482345, -0.44974833, 0.42635500}, {-0.58988658, -0.54565594, 0.59522551},
{-0.97115669, 0.13450224, 0.19688532}, {0.42988246, 0.15513097, -0.88945796}, {-0.30013401, -0.45617888, 0.83774722}, {0.50990724, -0.38026491, -0.77161727},
{-0.68923129, 0.29274099, -0.66276914}, {-0.81531731, -0.42344291, -0.39490984}, {0.26048163, -0.96468719, -0.03908901}, {0.32147033, 0.32614689, -0.88897977},
{0.70055924, -0.70700997, 0.09671429}, {-0.58890140, -0.17999683, 0.78790626}, {0.70222863, 0.69308083, -0.16283095}, {-0.75366081, -0.65098223, -0.09065052},
{-0.19053922, -0.78772343, -0.58582130}, {-0.58846812, 0.34955220, 0.72905317}, {-0.60563594, -0.40529546, -0.68479244}, {-0.71315551, 0.69904447, 0.05240265},
{-0.45479055, 0.81186703, -0.36611129}, {-0.29059626, 0.05377439, 0.95533352}, {0.56290473, 0.78501299, 0.25863657}, {-0.43010366, -0.47609705, 0.76703484},
{0.63372606, -0.06214270, -0.77105744}, {0.28788198, -0.78226752, -0.55243234}, {-0.55506056, 0.67832002, -0.48144545}, {-0.47229498, 0.84794057, -0.24069533},
{-0.27628326, 0.87423025, -0.39923556}, {0.97754921, -0.01429369, -0.21022189}, {-0.78483628, 0.30941478, -0.53693064}, {-0.35769150, -0.53057471, 0.76847073},
{0.56804560, 0.59946775, -0.56388173}, {0.80328735, -0.57298006, -0.16255243}, {-0.34327107, -0.35133498, -0.87105034}, {0.80357102, -0.01979284, -0.59487970},
{-0.87804782, 0.46346126, 0.11931336}, {-0.11872912, -0.93845057, 0.32436695}, {0.68065237, 0.69467363, 0.23268195}, {-0.71974506, -0.36713686, 0.58921776},
{0.52822234, 0.82314813, -0.20834663}, {-0.67654042, -0.73158271, 0.08414148}, {-0.39062516, 0.89358947, -0.22115571}, {-0.62142505, 0.43386674, -0.65237302},
{-0.48099381, -0.18611372, -0.85674188}, {0.05036514, -0.74987003, 0.65966528}, {-0.49984895, -0.80920390, -0.30877188}, {0.50496868, 0.85618105, 0.10936472},
{-0.54084761, 0.24485715, 0.80469176}, {-0.81973873, -0.50777759, 0.26493457}, {0.72082268, -0.43713926, -0.53788839}, {0.91725234, -0.15187152, 0.36821621},
{-0.17151325, 0.57985483, 0.79646192}, {-0.74076471, 0.06061813, -0.66902398}, {0.32541463, -0.08200506, 0.94200875}, {-0.10818362, 0.99402161, -0.01474260},
{-0.61710380, -0.78296663, 0.07839742}, {-0.38878719, -0.57916742, 0.71652608}, {0.37911419, 0.92170992, 0.08199541}, {-0.60810067, -0.43108035, 0.66662082},
{-0.11745691, 0.38395577, 0.91585034}, {0.47694470, -0.81050760, 0.34000174}, {0.40287244, 0.88894800, 0.21786522}, {0.46780815, -0.54966937, 0.69211207},
{0.07109649, 0.79259959, -0.60558333}, {-0.52073054, -0.06778631, 0.85102569}, {-0.36866700, 0.77676019, -0.51061556}, {-0.71702100, -0.35727116, 0.59853004},
{-0.59010862, -0.73536014, -0.33319257}, {-0.66875911, 0.58597660, 0.45759445}, {-0.59798034, -0.69169805, 0.40493619}, {-0.20490060, 0.79048994, 0.57718402},
{0.48765302, 0.85851673, 0.15856717}, {0.88918101, 0.10371433, 0.44564612}, {0.48664272, 0.83596000, 0.25367252}, {-0.24554119, 0.50230038, -0.82909822},
{0.03554055, -0.41884154, -0.90736356}, {-0.03701100, -0.61772404, 0.78552352}, {0.42824046, 0.20582938, -0.87991158}, {-0.06839464, -0.43555129, -0.89756183},
{-0.40866952, -0.70331213, -0.58167111}, {-0.74822692, 0.38256599, 0.54203297}, {0.71541445, 0.51615594, 0.47091953}, {0.60759905, -0.70288934, -0.36982423},
{-0.01648745, -0.13394229, -0.99085197}, {-0.64568452, -0.13342451, 0.75185730}, {-0.42008783, 0.33302268, 0.84416948}, {-0.63557180, -0.46817632, 0.61388877},
{-0.82478405, -0.45636029, 0.33386606}, {-0.66628051, 0.24058840, 0.70582399}, {-0.60499178, -0.78374178, -0.14047697}, {0.63041860, -0.60894989, -0.48140672},
{-0.07945150, -0.91288865, -0.40040202}, {-0.66942344, 0.18523930, 0.71941550}, {-0.00849762, -0.47038898, 0.88241827}, {0.66223413, -0.33585751, 0.66981019},
{0.82512667, -0.23099667, -0.51556427}, {-0.75186864, 0.65450118, -0.07950940}, {0.87383910, 0.08193441, 0.47926192}, {-0.26554211, 0.78650504, 0.55758158},
{-0.49574252, 0.70523568, 0.50683527}, {-0.49212635, -0.64694353, 0.58247381}, {0.32264136, 0.78159510, -0.53386482}, {0.71510371, -0.22498049, 0.66182359},
{0.61434883, -0.51790453, 0.59527340}, {-0.82551670, -0.14228251, -0.54614821}, {-0.46251954, 0.64306734, -0.61036060}, {-0.52117891, -0.69061769, 0.50141773},
{0.27468699, -0.88951139, -0.36512537}, {0.65713642, -0.75365863, -0.01305358}, {0.94136220, -0.21960140, -0.25614924}, {-0.85554460, 0.30842011, -0.41583708},
{-0.35233681, -0.15379949, 0.92314922}, {-0.74432132, 0.44164975, -0.50093040}, {0.53994954, -0.79953954, -0.26304184}, {0.42964607, 0.11880600, 0.89514769},
{-0.87921789, 0.18018271, 0.44103298}, {-0.80353079, 0.36514238, 0.47011628}, {0.50404538, 0.65465655, -0.56334986}, {-0.92083981, -0.30381360, -0.24444087},
{0.13956423, -0.96009192, -0.24237437}, {-0.71698508, 0.68682212, 0.11919639}, {-0.76698836, 0.61675487, -0.17703754}, {-0.21874818, -0.57847904, -0.78581883},
{0.55494484, -0.79971185, 0.22912262}, {0.79660662, -0.41090893, 0.44336412}, {0.66489466, 0.00947646, -0.74687703}, {-0.59920476, 0.36935905, 0.71030103},
{-0.57524868, -0.51402380, -0.63629277}, {0.20536135, -0.69296940, 0.69110066}, {-0.05544564, -0.99802158, 0.02964287}, {0.13201661, 0.16519726, -0.97738502},
{0.46510187, 0.64584669, -0.60544390}, {-0.80108393, -0.59762086, 0.03337417}, {-0.39806873, -0.44410006, -0.80269323}, {0.95136791, -0.21916666, -0.21648342},
{-0.82086395, 0.17982074, 0.54207645}, {0.79513089, 0.37056075, 0.48005374}, {0.77112323, 0.56616567, 0.29124800}, {0.81176337, -0.24837815, 0.52853432},
{-0.81842091, 0.50060656, 0.28209979}, {-0.38248924, -0.72602893, 0.57147525}, {0.46198573, 0.37950267, 0.80159024}, {-0.59524911, 0.04222053, 0.80243126},
{-0.52273882, 0.79497643, -0.30782561}, {-0.79922245, 0.45390541, 0.39397125}, {0.38051244, -0.76512679, 0.51941436}, {0.83818590, 0.22605420, 0.49633043},
{0.63218067, 0.48127057, 0.60722832}, {0.59242495, 0.18424992, -0.78427333}, {0.85249021, -0.48552132, 0.19372531}, {-0.43548364, -0.58439144, 0.68471939},
{0.73179011, 0.29594379, -0.61392223}, {-0.45280534, -0.80755156, 0.37792566}, {0.55557939, 0.30092870, -0.77509578}, {0.42575514, 0.70893498, 0.56226662},
{0.60528173, -0.51550786, 0.60653580}, {-0.51076670, 0.84729685, -0.14562083}, {-0.33474095, 0.69713420, -0.63399716}, {-0.48650711, 0.74561924, 0.45537104},
{-0.41670009, -0.87381546, -0.25061440}, {0.92586094, -0.34254116, -0.15952140}, {-0.10682502, 0.59910669, 0.79351092}, {-0.44718479, -0.59299328, 0.66961536},
{0.69862855, -0.48858264, 0.52269031}, {-0.74718902, 0.51933770, -0.41472512}, {-0.56931667, 0.42835158, 0.70170753}, {0.05154068, 0.16647211, 0.98469823},
{0.74568360, -0.66371406, 0.05864824}, {0.64686641, 0.41668704, 0.63869849}, {0.27796256, -0.73021674, 0.62411563}, {0.77079499, -0.62615383, 0.11750087},
{-0.06833979, 0.90160690, 0.42712371}, {-0.98003087, -0.09480635, 0.17478914}, {-0.85191651, 0.47279136, 0.22518122}, {0.52473004, -0.19693989, -0.82817454},
{0.16081399, 0.75081437, -0.64063768}, {0.71441816, 0.52488995, -0.46270642}, {-0.23333515, -0.88652173, 0.39954216}, {0.54760612, -0.74897952, -0.37303782},
{0.48186221, -0.57810371, 0.65848683}, {-0.21255857, -0.53489421, -0.81774509}, {0.77930308, 0.57549405, -0.24797842}, {0.60279872, -0.76604104, -0.22319235},
{0.37230136, -0.52720909, 0.76383393}, {-0.13321231, -0.92277683, 0.36157627}, {-0.47833070, -0.49076061, -0.72825392}, {0.28828612, -0.93601402, 0.20191301},
{-0.66460360, -0.65589055, 0.35792406}, {0.90686144, 0.30403802, 0.29182738}, {-0.00682204, 0.42199214, 0.90657382}, {-0.33221520, 0.26584830, -0.90496284},
{-0.59515132, 0.55081686, 0.58514588}, {0.77123373, 0.59869357, -0.21625109}, {-0.69765329, -0.61042387, 0.37505011}, {0.02426772, -0.55656860, -0.83044715},
{0.65180023, 0.75814507, 0.01930051}, {-0.01531784, -0.78276243, 0.62213209}, {0.63847163, 0.03936370, 0.76863807}, {0.40703600, -0.09783879, -0.90815707},
{-0.46223121, -0.64783550, -0.60551753}, {0.82788442, -0.46539053, 0.31307993}, {-0.75467147, 0.24001984, 0.61062382}, {-0.70062375, -0.69087941, 0.17835919},
{0.35457466, 0.88605939, -0.29862279}, {0.20159504, -0.88658663, -0.41632150}, {-0.32096612, 0.72494426, -0.60945597}, {0.14147986, 0.53949815, -0.83001518},
{0.28297638, 0.93772862, 0.20146813}, {0.67192636, 0.43759891, -0.59751332}, {0.98497844, 0.01967209, 0.17155312}, {0.60388215, -0.68969665, 0.39955586},
{0.41200242, 0.85002960, 0.32818240}, {-0.83375884, 0.39266173, -0.38815328}, {-0.70938505, -0.58502714, -0.39308535}, {-0.63048972, 0.77513872, 0.04053013},
{0.10261233, -0.69355480, -0.71305852}, {0.65702752, -0.38976767, -0.64528753}, {-0.41388260, 0.33890875, 0.84489174}, {0.03028400, -0.46424256, -0.88519022},
{0.45068344, -0.52775066, -0.71997478}, {0.48930093, 0.41323002, -0.76800101}, {0.28350070, 0.66390322, 0.69199701}, {0.42450922, -0.60916900, 0.66985450},
{0.67306932, 0.51724488, -0.52861652}, {0.31095891, 0.94487804, -0.10251852}, {-0.25569777, 0.90632689, -0.33643754}, {-0.21431592, 0.07778980, -0.97366187},
{0.27676605, -0.87464593, 0.39798876}, {0.00288072, -0.88726140, -0.46125796}, {0.51138622, 0.12353356, 0.85042554}, {0.59734197, 0.76052363, 0.25453168},
{-0.43336730, -0.76588813, 0.47498227}, {0.34180565, -0.68750195, -0.64071052}, {-0.65078280, 0.51803512, 0.55508681}, {-0.89824124, 0.40466264, -0.17149586},
{0.54253116, 0.81082175, -0.21960883}, {-0.53994336, 0.54836630, 0.63855741}, {0.68778819, 0.33483595, -0.64407475}, {-0.63530446, -0.39864092, 0.66141792},
{0.80728009, -0.58358794, -0.08788616}, {0.94835277, 0.26419320, 0.17558181}, {-0.15823843, -0.51165316, 0.84449490}, {0.17510951, -0.22389002, 0.95875436},
{0.13697442, -0.88598087, 0.44303037}, {-0.73457485, -0.23332652, -0.63714874}, {0.95521505, -0.11801760, 0.27135964}, {-0.40184319, -0.90170455, -0.15953355},
{0.16857866, -0.70975159, -0.68398386}, {-0.55230772, 0.37144476, 0.74631426}, {0.29875717, -0.61848962, -0.72678383}, {0.62465217, -0.76131685, 0.17379963},
{0.75759704, 0.19352541, 0.62337360}, {-0.10375594, 0.61563856, 0.78116827}, {0.52725731, 0.25296549, 0.81117704}, {-0.71292545, -0.53989924, -0.44748867},
{0.78246146, 0.54867457, 0.29446609}, {0.31458005, 0.63401883, -0.70644145}, {-0.09360697, -0.99481997, -0.03963538}, {-0.59000956, 0.10880136, -0.80003186},
{0.49713243, 0.77379744, -0.39255173}, {-0.92985377, 0.17383167, 0.32427537}, {0.73574353, -0.63730495, -0.22918086}, {-0.04383386, -0.80273910, -0.59471719},
{0.68411849, 0.52929683, -0.50182344}, {-0.19561815, -0.57428906, -0.79493749}, {0.90257811, -0.06366895, -0.42579222}, {0.62294256, 0.39027502, -0.67795868},
{-0.39046281, -0.70398950, 0.59324327}, {0.70990020, 0.62433400, -0.32595821}, {-0.99157404, 0.01300690, 0.12888658}, {-0.55765988, -0.46179257, 0.68975581},
{-0.53736280, -0.34635255, -0.76894807}, {0.25083685, 0.44726649, -0.85850659}, {0.45758528, 0.86982087, -0.18446507}, {-0.18615519, 0.23441065, -0.95414773},
{0.56359579, -0.41325118, -0.71525048}, {-0.48542469, 0.59678985, -0.63890903}, {-0.72243931, -0.40815930, 0.55811059}, {-0.23748605, 0.68466361, -0.68908354},
{-0.69257361, 0.27959985, -0.66495543}, {-0.10352601, -0.17369566, -0.97934273}, {0.00192480, -0.09194122, 0.99576258}, {0.36297645, 0.86362173, 0.34986513},
{-0.71118388, -0.10242990, 0.69550385}, {0.45146824, 0.43080300, 0.78139952}, {-0.13265094, -0.68773403, -0.71374059}, {0.56016516, -0.56270148, -0.60793259},
{-0.95871022, -0.27465634, -0.07374694}, {-0.84169709, 0.06533746, -0.53598230}, {0.69711911, -0.61618111, -0.36653212}, {-0.01620384, 0.59778204, -0.80149490},
{-0.34911215, 0.65899531, -0.66621760}, {-0.19279427, -0.50540811, -0.84106659}, {-0.60506152, 0.72292944, 0.33357695}, {0.79789244, -0.59553505, 0.09330415},
{-0.48173680, -0.74189415, 0.46639331}, {0.84140763, 0.31839867, 0.43664115}, {0.79614481, 0.60391839, -0.03789486}, {0.19384456, 0.57096572, 0.79776089},
{0.83441754, -0.25078854, -0.49076723}, {-0.62605441, 0.72550166, 0.28583776}, {0.55337866, -0.75558589, 0.35051679}, {0.80543476, -0.01571309, 0.59247611},
{-0.00851542, 0.98991715, 0.14139139}, {-0.94076275, -0.29730096, -0.16302633}, {-0.75465549, -0.41353736, -0.50939371}, {0.37739255, -0.63080384, 0.67798332},
{0.47325376, -0.73145333, -0.49092453}, {0.12930721, -0.49066326, -0.86170135}, {0.71173142, -0.11663112, 0.69270165}, {0.41952295, -0.63051086, -0.65303641},
{0.85916103, 0.42641569, 0.28286390}, {0.54792224, -0.66418740, 0.50856299}, {0.28479416, 0.43856869, 0.85237890}, {-0.59050384, -0.68486024, -0.42693285},
{0.54884141, 0.60847988, 0.57317130}, {0.87567478, 0.25649070, -0.40915304}, {0.02961573, 0.33496172, 0.94176619}, {0.67428181, 0.70665199, 0.21444580},
{0.23609059, -0.51982231, 0.82100305}, {0.93726653, 0.00671493, 0.34854893}, {-0.39891590, -0.91536143, -0.05458531}, {0.93359117, -0.35793085, 0.01711843},
{0.53572079, -0.56879583, 0.62407896}, {-0.61516933, -0.36856434, -0.69694119}, {0.74630703, -0.65946218, -0.09019675}, {0.50607373, -0.59204544, -0.62719342},
{-0.89793356, 0.43675114, 0.05444050}, {-0.91682171, 0.07126199, 0.39288634}, {-0.61178292, -0.15203616, -0.77627744}, {-0.14028895, 0.63023583, 0.76362413},
{0.71475895, -0.54060748, 0.44369268}, {-0.31764961, 0.92630790, -0.20261391}, {0.59833443, -0.58864018, -0.54359788}, {-0.81450219, 0.22699691, -0.53390879},
{0.00452737, -0.06652318, 0.99777461}, {0.59311614, 0.19797584, -0.78039657}, {-0.71375488, -0.02586188, 0.69991795}, {-0.75600145, -0.26384588, -0.59903853},
{0.25716644, 0.77480857, -0.57752671}, {0.71712423, 0.61984999, -0.31862018}, {-0.28194922, -0.55108799, 0.78537040}, {0.57068285, -0.67066160, 0.47385030},
{0.48969101, -0.22604767, -0.84208382}, {-0.93763991, -0.34062289, 0.06933579}, {-0.67376035, 0.15110895, -0.72333469}, {-0.72414406, -0.65877431, -0.20403872},
{-0.71204285, 0.41163046, -0.56881926}, {0.23641604, -0.86280490, 0.44685026}, {0.84208951, 0.19949878, -0.50108432}, {-0.67481860, 0.67904385, -0.28899707},
{0.52167146, 0.66360202, 0.53618211}, {-0.49330390, -0.48590434, 0.72149029}, {-0.18240720, 0.04137646, -0.98235208}, {0.30714395, 0.55170433, 0.77542564},
{-0.14577549, 0.95376355, -0.26283949}, {-0.54373260, -0.69781662, -0.46626905}, {0.01799205, -0.81833182, 0.57446437}, {0.51019037, -0.56615200, -0.64743934},
{0.48463473, 0.59436639, 0.64176146}, {0.09115853, -0.52830175, -0.84414891}, {-0.62962436, -0.38408030, -0.67531880}, {0.50864721, -0.48401592, -0.71204396},
{-0.69669235, -0.63427804, -0.33512853}, {0.60735178, -0.18339351, 0.77297518}, {0.74102699, 0.67064566, 0.03336744}, {-0.47352242, -0.76145583, -0.44267543},
{0.47751531, -0.79737827, -0.36900816}, {0.74175025, -0.64892413, 0.16942269}, {0.65484829, -0.70924167, -0.26105549}, {0.60455058, -0.64392987, -0.46890608},
{-0.61878613, -0.77223405, 0.14407742}, {-0.72376655, -0.65562529, 0.21521492}, {0.24420910, -0.52118606, -0.81775731}, {0.61291622, 0.39870471, -0.68217906},
{0.67751893, 0.65970488, 0.32520389}, {-0.04366879, -0.96113671, 0.27259726}, {0.36541094, 0.62808212, 0.68701361}, {-0.92572867, 0.10611717, -0.36299528},
{0.80766374, -0.02031352, -0.58929335}, {-0.82117076, 0.53034081, 0.21075390}, {-0.62778197, -0.51872129, 0.58036025}, {0.37696186, 0.57743439, -0.72420251},
{-0.56818895, -0.47089866, -0.67484500}, {-0.61126182, -0.69853192, 0.37203783}, {0.57901952, 0.81284241, -0.06343191}, {-0.53287943, 0.70445351, 0.46881208},
{0.22300157, -0.93258969, 0.28380764}, {-0.63832115, -0.40157013, -0.65672486}, {-0.22074780, 0.50999380, 0.83137040}, {-0.59081050, -0.13684815, -0.79511982},
{-0.79824305, 0.52060475, -0.30295004}, {-0.56871170, 0.76435226, 0.30386284}, {0.12786983, -0.64236825, -0.75565358}, {-0.17631562, -0.76167939, -0.62350405},
{0.34713709, 0.61125835, -0.71123770}, {-0.39238887, -0.52886732, 0.75254922}, {0.38116332, 0.71358998, -0.58779577}, {-0.72949527, -0.67040404, 0.13562844},
{-0.62057913, 0.45165344, -0.64100757}, {-0.10668918, -0.98309252, -0.14881706}, {0.59490400, -0.46196716, -0.65778079}, {0.22433782, 0.49054463, 0.84204424},
{0.77498791, -0.57220981, 0.26827165}, {0.26474565, 0.93986866, -0.21576987}, {-0.01328623, 0.99975439, 0.01773780}, {0.53097408, 0.47771884, 0.69989373},
{0.24635212, -0.37499947, -0.89369236}, {0.31300988, -0.54171955, 0.78010560}, {0.77494650, -0.52634980, 0.34987684}, {0.65518408, 0.51410661, -0.55355958},
{0.78000762, -0.61855443, -0.09475515}, {0.58176976, 0.62638121, 0.51883574}, {-0.62371886, -0.59433046, 0.50768699}, {0.85206333, 0.17478222, -0.49339564},
{0.69974170, -0.42963013, 0.57077098}, {-0.44953934, 0.62956163, -0.63369277}, {0.63562255, 0.51965998, -0.57090935}, {-0.02766532, -0.52812789, -0.84871406},
{0.78698609, 0.04742916, -0.61514500}, {0.37827449, 0.78614098, 0.48876454}, {0.90534508, -0.25600916, -0.33883565}, {-0.37701605, 0.47347359, -0.79604124},
{-0.43802429, 0.40756165, -0.80126664}, {-0.87945568, -0.47372426, -0.04629300}, {-0.22787901, -0.82242670, 0.52123457}, {0.48721529, 0.74652617, -0.45312243},
{-0.68473990, -0.68222429, 0.25632263}, {-0.33289944, 0.62102263, -0.70958358}, {-0.07838790, -0.85438083, -0.51370101}, {0.18575601, 0.96209034, 0.19969195},
{0.09048656, -0.68256793, -0.72519874}, {0.29506068, -0.68306389, -0.66810397}, {-0.94937153, -0.17748927, 0.25921277}, {-0.38725072, 0.16372291, 0.90732116},
{-0.02691563, 0.81898594, 0.57318198}, {-0.65244629, -0.52276924, -0.54865851}, {0.15270967, -0.00097578, 0.98827061}, {0.39108739, 0.55471383, -0.73439990},
{0.85379797, -0.05140234, 0.51806064}, {0.31443713, 0.14998906, -0.93735403}, {-0.44277186, -0.56474741, -0.69642907}, {-0.31521736, 0.37268196, 0.87278071},
{0.97997903, -0.16829529, 0.10638514}, {-0.25174419, -0.84939324, 0.46384910}, {0.03867740, -0.72044135, 0.69243651}, {-0.80207202, 0.48047131, 0.35472214},
{0.48200634, -0.48413492, 0.73026246}, {-0.41800015, 0.44068588, -0.79440029}, {0.58661859, -0.43233611, 0.68480955}, {0.40830998, -0.53710845, 0.73810397},
{0.61242611, -0.72220206, -0.32149407}, {-0.34159283, -0.62199145, -0.70458567}, {-0.29885191, 0.58492128, -0.75402562}, {-0.62924060, 0.77130626, -0.09561862},
{0.91118189, 0.27762192, 0.30442344}, {0.08064464, -0.99213777, -0.09570315}, {0.93083382, -0.34928416, -0.10746612}, {0.66101659, -0.67569323, 0.32633681},
{0.07148482, -0.97619739, -0.20476469}, {0.30440743, -0.78193565, -0.54397863}, {-0.35656518, -0.19962907, 0.91269355}, {0.82151650, -0.31061678, 0.47815045},
{-0.69709423, -0.71173375, -0.08657198}, {-0.46044170, -0.78565215, -0.41321197}, {-0.70275364, -0.21121895, 0.67935548}, {0.38087769, 0.63933041, 0.66797366} };
// Simplex noise is evaluated on a tetrahedral grid, as opposed to a regular
// cube-based one. The two "skew factors" are used to convert between views
// of the grid so that calculations of which gridpoints to use are simpler.
// These numbers are straightforward for 3D, but the geometry is not so kind in
// 2D or 4D
static const double skewF3 = 1.0/3.0;
static const double skewG3 = 1.0/6.0;
// simplexNoise3D - given a vector in (x,y,z) returns the noise value for the
// location
double simplexNoise3D( double V[3] ) {
double C[4][3]; // Co-ordinates of four simplex shape corners in (x,y,z)
double n = 0.0; // Noise total value
int gi[4]; // Hashed grid index for each corner, used to determine gradient
double* U; // Pointer to current gradient vector . . .
int corner; // Iterator for which corner is being processed
double t; // Temp double
// Convert input co-ordinates ( x, y, z ) to
// integer-based simplex grid ( i, j, k )
double skewIn = ( V[_x_] + V[_y_] + V[_z_] ) * skewF3;
int i = floor( V[_x_] + skewIn );
int j = floor( V[_y_] + skewIn );
int k = floor( V[_z_] + skewIn );
t = (i + j + k) * skewG3;
// Cell origin co-ordinates in input space (x,y,z)
double X0 = i - t;
double Y0 = j - t;
double Z0 = k - t;
// This value of t finished with, not used later . . .
// Point offset within cell, in input space (x,y,z)
C[0][_x_] = V[_x_] - X0;
C[0][_y_] = V[_y_] - Y0;
C[0][_z_] = V[_z_] - Z0;
// For the 3D case, the simplex shape is a slightly irregular tetrahedron.
// The nested logic determines which simplex we are in, and therefore in which
// order to get gradients for the four corners
int i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords
int i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords
// The fourth corner is always i3 = 1, j3 = 1, k3 = 1, so no need to
// calculate values
if ( C[0][_x_] >= C[0][_y_] ) {
if ( C[0][_y_] >= C[0][_z_] ) {
i1=1; j1=0; k1=0; i2=1; j2=1; k2=0;
} else { // y0<z0
if( C[0][_x_] >= C[0][_z_] ) {
i1=1; j1=0; k1=0; i2=1; j2=0; k2=1;
} else {
i1=0; j1=0; k1=1; i2=1; j2=0; k2=1;
}
}
} else { // x0<y0
if( C[0][_y_] < C[0][_z_] ) {
i1=0; j1=0; k1=1; i2=0; j2=1; k2=1;
} else {
if( C[0][_x_] < C[0][_z_] ) {
i1=0; j1=1; k1=0; i2=0; j2=1; k2=1;
} else {
i1=0; j1=1; k1=0; i2=1; j2=1; k2=0;
} // Y X Z order
}
}
// A step of 1i in (i,j,k) is a step of (1-skewG3, -skewG3, -skewG3) in (x,y,z),
// and this is similar for j and k . . .
// Offsets for second corner in (x,y,z) coords
C[1][_x_] = C[0][_x_] - i1 + skewG3;
C[1][_y_] = C[0][_y_] - j1 + skewG3;
C[1][_z_] = C[0][_z_] - k1 + skewG3;
// Offsets for third corner in (x,y,z) coords
C[2][_x_] = C[0][_x_] - i2 + 2.0 * skewG3;
C[2][_y_] = C[0][_y_] - j2 + 2.0 * skewG3;
C[2][_z_] = C[0][_z_] - k2 + 2.0 * skewG3;
// Offsets for last corner in (x,y,z) coords
C[3][_x_] = C[0][_x_] - 1.0 + 3.0 * skewG3;
C[3][_y_] = C[0][_y_] - 1.0 + 3.0 * skewG3;
C[3][_z_] = C[0][_z_] - 1.0 + 3.0 * skewG3;
// Work out the hashed gradient indices of the four simplex corners
int ii = i & 0x3ff;
int jj = j & 0x3ff;
int kk = k & 0x3ff;
gi[0] = p[ii + p[jj + p[kk]]];
gi[1] = p[ii + i1 + p[jj + j1 + p[kk + k1]]];
gi[2] = p[ii + i2 +p[jj + j2 + p[kk + k2]]];
gi[3] = p[ii + 1 + p[jj + 1 + p[kk + 1]]];
// Calculate the contribution from the four corners, and add to total
for( corner = 0; corner < 4; corner++ ) {
t = 0.6 - C[corner][_x_] * C[corner][_x_] - C[corner][_y_] * C[corner][_y_] - C[corner][_z_] * C[corner][_z_] ;
if(t > 0.0) {
U = grad3[ gi[corner] ];
t *= t;
n += t * t * ( U[_x_] * C[corner][_x_] + U[_y_] * C[corner][_y_] + U[_z_] * C[corner][_z_] );
}
}
// The result is scaled be fit -1.0 to 1.0
return 32.0 * n;
}
// The Perlin noise function is based on summing coherent noise in "octaves"
double perlinNoise3D(double V[3], double aScale, double fScale, int octaves) {
int i; // Iterator
double n = 0.0; // Sum of noise values
double U[3];
double a = 1.0;
U[_x_] = V[_x_];
U[_y_] = V[_y_];
U[_z_] = V[_z_];
for (i=0; i < octaves; i++) {
n += simplexNoise3D(U) / a;
// None of the below required for last octave . . .
a *= aScale;
U[_x_] *= fScale;
U[_y_] *= fScale;
U[_z_] *= fScale;
}
return n;
}
double vratio( double P[2], double Q[2], double U[2] ) {
double PmQx, PmQy;
PmQx = P[_x_] - Q[_x_];
PmQy = P[_y_] - Q[_y_];
if ( 0.0 == PmQx && 0.0 == PmQy ) {
return 1.0;
}
return 2.0 * ( ( U[_x_] - Q[_x_] ) * PmQx + ( U[_y_] - Q[_y_] ) * PmQy ) / ( PmQx * PmQx + PmQy * PmQy );
}
// Closest point to U from array P.
// P is an array of points
// n is number of points to check
// U is location to find closest
int closest( double P[VORONOI_MAXPOINTS][2], int n, double U[2] ) {
double d2;
double d2min = 1.0e100;
int i, j;
for( i = 0; i < n; i++ ) {
d2 = (P[i][_x_] - U[_x_]) * (P[i][_x_] - U[_x_]) + (P[i][_y_] - U[_y_]) * (P[i][_y_] - U[_y_]);
if ( d2 < d2min ) {
d2min = d2;
j = i;
}
}
return j;
}
// Voronoi "value" is 0.0 (centre) to 1.0 (edge) if inside cell . . . higher values
// mean that point is not in the cell defined by chosen centre.
// P is an array of points defining cell centres
// n is number of points in array
// q is chosen centre to measure distance from
// U is point to test
double voronoi( double P[VORONOI_MAXPOINTS][2], int n, int q, double U[2] ) {
double ratio;
double ratiomax = -1.0e100;
int i;
for( i = 0; i < n; i++ ) {
if ( i != q ) {
ratio = vratio( P[i], P[q], U );
if ( ratio > ratiomax ) {
ratiomax = ratio;
}
}
}
return ratiomax;
}
// Waffle's cells are based on a simple square grid which is distorted using a noise function
// position() calculates cell centre for cell (x, y), given plane slice z, scale factor s, distortion d
// and stores in supplied array
void position( int x, int y, double z, double s, double d, double V[2] ) {
double E[3], F[3];
// Values here are arbitrary, chosen simply to be far enough apart so they do not correlate
E[_x_] = x * 2.5;
E[_y_] = y * 2.5;
E[_z_] = z * 2.5;
// Cross-over between x and y is intentional
F[_x_] = y * 2.5 + 30.2;
F[_y_] = x * 2.5 - 12.1;
F[_z_] = z * 2.5 + 19.8;
V[_x_] = ( x + d * simplexNoise3D( E ) ) * s;
V[_y_] = ( y + d * simplexNoise3D( F ) ) * s;
}
// cached_position gives centre co-ordinates either from cache, or calculated from scratch if needed
void cached_position( double Cache[CACHE_WIDTH][CACHE_WIDTH][2], int x, int y, double z, double s, double d, double V[2] ) {
if ( abs(x) <= CACHE_NUM && abs(y) <= CACHE_NUM ) {
V[_x_] = Cache[x+CACHE_NUM][y+CACHE_NUM][_x_];
V[_y_] = Cache[x+CACHE_NUM][y+CACHE_NUM][_y_];
} else {
position( x,y,z,s,d,V );
}
}
// Set the name of this plugin
APO_PLUGIN("crackle");
// Define the Variables
APO_VARIABLES(
VAR_REAL(crackle_cellsize, 1.0),
VAR_REAL(crackle_power, 0.2),
VAR_REAL(crackle_distort, 0.0),
VAR_REAL(crackle_scale, 1.0),
VAR_REAL(crackle_z, 0.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
// Pre-calculate cache of grid centres, to save time later . . .
int x,y;
for ( x= -CACHE_NUM; x <= CACHE_NUM; x++ ) { for ( y= -CACHE_NUM; y <= CACHE_NUM; y++ ) {
position( x, y, VAR(crackle_z), VAR(crackle_cellsize) / 2.0, VAR(crackle_distort), VAR(C)[x+CACHE_NUM][y+CACHE_NUM] );
} }
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double XCo, YCo, DXo, DYo, L, R, s, trgL;
double U[2];
int XCv, YCv;
// An infinite number of invisible cells? No thanks!
if ( 0.0 == VAR(crackle_cellsize) ) {
return TRUE;
}
// Scaling factor
s = VAR(crackle_cellsize) / 2.0;
// For a blur effect, base everything starting on a circle radius 1.0
// (as opposed to reading the values from FTx and FTy)
double blurr = (random01() + random01()) / 2.0 + ( random01() - 0.5 ) / 4.0;
double theta = 2 * M_PI * random01();
U[_x_] = blurr * sin(theta);
U[_y_] = blurr * cos(theta);
// Use integer values as Voronoi grid co-ordinates
XCv = (int) floor( U[_x_] / s );
YCv = (int) floor( U[_y_] / s );
// Get a set of 9 square centre points, based around the one above
int di, dj;
int i = 0;
for (di = -1; di < 2; di++) { for (dj = -1; dj < 2; dj++) {
cached_position( VAR(C), XCv+di, YCv+dj, VAR(crackle_z), s, VAR(crackle_distort), VAR(P)[i] );
i++;
} }
int q = closest( VAR(P), 9, U );
int offset[9][2] = { { -1, -1}, { -1, 0}, { -1, 1},
{ 0, -1}, { 0, 0}, { 0, 1},
{ 1, -1}, { 1, 0}, { 1, 1} };
// Remake list starting from chosen square, ensure it is completely surrounded (total 9 points)
// First adjust centres according to which one was found to be closest
XCv += offset[q][_x_];
YCv += offset[q][_y_];
// Get a new set of 9 square centre points, based around the definite closest point
i=0;
for (di = -1; di < 2; di++) { for (dj = -1; dj < 2; dj++) {
cached_position( VAR(C), XCv+di, YCv+dj, VAR(crackle_z), s, VAR(crackle_distort), VAR(P)[i] );
i++;
} }
L = voronoi( VAR(P), 9, 4, U ); // index 4 is centre cell
// Delta vector from centre
DXo = U[_x_] - VAR(P)[4][_x_];
DYo = U[_y_] - VAR(P)[4][_y_];
/////////////////////////////////////////////////////////////////
// Apply "interesting bit" to cell's DXo and DYo co-ordinates
// trgL is the new value of L
trgL = pow(L + 1e-100, VAR(crackle_power)) * VAR(crackle_scale); // ( 0.9 )
R = trgL / ( L + 1e-100 );
DXo *= R;
DYo *= R;
// Add cell centre co-ordinates back in
DXo += VAR(P)[4][_x_];
DYo += VAR(P)[4][_y_];
// Finally add values in
FPx += VVAR * DXo;
FPy += VVAR * DYo;
return TRUE;
}

73
Plugin/curve.c Normal file
View File

@ -0,0 +1,73 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double curve_xamp;
double curve_xlength;
double curve_yamp;
double curve_ylength;
// precalc values:
double pc_xamp;
double pc_yamp;
double pc_xlen;
double pc_ylen;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("curve");
// Define the Variables
APO_VARIABLES(
VAR_REAL(curve_xamp, 0.0),
VAR_REAL(curve_yamp, 0.0),
VAR_REAL(curve_xlength, 1.0),
VAR_REAL(curve_ylength, 1.0)
);
inline double fmax(double a, double b) {
return a > b ? a : b;
}
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(pc_xamp) = VVAR * VAR(curve_xamp);
VAR(pc_yamp) = VVAR * VAR(curve_yamp);
VAR(pc_xlen) = 1.0 / fmax(VAR(curve_xlength) * VAR(curve_xlength), 1E-20);
VAR(pc_ylen) = 1.0 / fmax(VAR(curve_ylength) * VAR(curve_ylength), 1E-20);
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
FPx += VVAR * FTx + VAR(pc_xamp) * exp(-FTy * FTy * VAR(pc_xlen));
FPy += VVAR * FTy + VAR(pc_yamp) * exp(-FTx * FTx * VAR(pc_ylen));
return TRUE;
}

85
Plugin/dc_boarders.c Normal file
View File

@ -0,0 +1,85 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define APO_NOVARIABLES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("dc_boarders");
inline double rint(double x)
{
int temp; temp = (x >= 0. ? (int)(x + 0.5) : (int)(x - 0.5));
return (double)temp;
}
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double roundX, roundY, offsetX, offsetY;
roundX = rint(FTx);
roundY = rint(FTy);
offsetX = FTx - roundX;
offsetY = FTy - roundY;
if(random01() >= 0.75)
{
FPx += VVAR*(offsetX*0.5 + roundX);
FPy += VVAR*(offsetY*0.5 + roundY);
}
else
{
if(fabs(offsetX) >= fabs(offsetY))
{
if(offsetX >= 0.0)
{
FPx += VVAR*(offsetX*0.5 + roundX + 0.25);
FPy += VVAR*(offsetY*0.5 + roundY + 0.25 * offsetY / offsetX);
}
else
{
FPx += VVAR*(offsetX*0.5 + roundX - 0.25);
FPy += VVAR*(offsetY*0.5 + roundY - 0.25 * offsetY / offsetX);
}
}
else
{
if(offsetY >= 0.0)
{
FPy += VVAR*(offsetY*0.5 + roundY + 0.25);
FPx += VVAR*(offsetX*0.5 + roundX + offsetX/offsetY*0.25);
}
else
{
FPy += VVAR*(offsetY*0.5 + roundY - 0.25);
FPx += VVAR*(offsetX*0.5 + roundX - offsetX/offsetY*0.25);
}
}
}
return TRUE;
}

55
Plugin/dc_bubble.c Normal file
View File

@ -0,0 +1,55 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double dc_bubble_centerx;
double dc_bubble_centery;
double dc_bubble_scale;
double bdcs;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("dc_bubble");
APO_VARIABLES(
VAR_REAL(dc_bubble_centerx, 0.0),
VAR_REAL(dc_bubble_centery, 0.0),
VAR_REAL(dc_bubble_scale, 1.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(bdcs) = 1.0 / (VAR(dc_bubble_scale) == 0.0 ? 10E-6 : VAR(dc_bubble_scale));
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double r = (sqr(FTx) + sqr(FTy));
double r4_1 = r / 4.0 + 1.0;
r4_1 = VVAR / r4_1;
FPx += FPx + r4_1 * FTx;
FPy += FPy + r4_1 * FTy;
FPz += FPz + VVAR * (2.0 / r4_1 - 1.0);
TC = fmod(fabs(VAR(bdcs) * (sqr(FPx + VAR(dc_bubble_centerx)) + sqr(FPy + VAR(dc_bubble_centery)))), 1.0);
return TRUE;
}

63
Plugin/dc_cube.c Normal file
View File

@ -0,0 +1,63 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double dc_cube_c1, dc_cube_c2, dc_cube_c3,
dc_cube_c4, dc_cube_c5, dc_cube_c6;
double dc_cube_x, dc_cube_y, dc_cube_z;
double c1, c2, c3, c4, c5, c6;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("dc_cube");
APO_VARIABLES(
VAR_REAL(dc_cube_c1, 0.0), VAR_REAL(dc_cube_c2, 0.0),
VAR_REAL(dc_cube_c3, 0.0), VAR_REAL(dc_cube_c4, 0.0),
VAR_REAL(dc_cube_c5, 0.0), VAR_REAL(dc_cube_c6, 0.0),
VAR_REAL(dc_cube_x, 1.0), VAR_REAL(dc_cube_y, 1.0),
VAR_REAL(dc_cube_z, 1.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(c1) = VAR(dc_cube_c1)<0?0:VAR(dc_cube_c1)>1?1:VAR(dc_cube_c1);
VAR(c2) = VAR(dc_cube_c2)<0?0:VAR(dc_cube_c2)>1?1:VAR(dc_cube_c2);
VAR(c3) = VAR(dc_cube_c3)<0?0:VAR(dc_cube_c3)>1?1:VAR(dc_cube_c3);
VAR(c4) = VAR(dc_cube_c4)<0?0:VAR(dc_cube_c4)>1?1:VAR(dc_cube_c4);
VAR(c5) = VAR(dc_cube_c5)<0?0:VAR(dc_cube_c5)>1?1:VAR(dc_cube_c5);
VAR(c6) = VAR(dc_cube_c6)<0?0:VAR(dc_cube_c6)>1?1:VAR(dc_cube_c6);
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double x, y, z;
double p = 2*random01()-1, q = 2*random01()-1;
int i = rand() % 3, j = rand() & 1; switch (i) {
case 0: x = VVAR * (j?-1:1); y = VVAR * p; z = VVAR * q;
if(j) TC=VAR(c1); else TC=VAR(c2); break;
case 1: x = VVAR * p; y = VVAR * (j?-1:1); z = VVAR * q;
if(j) TC=VAR(c3); else TC=VAR(c4); break;
case 2: x = VVAR * p; y = VVAR * q; z = VVAR * (j?-1:1);
if(j) TC=VAR(c5); else TC=VAR(c6); break;
}
FPx += x * VAR(dc_cube_x); FPy += y * VAR(dc_cube_y); FPz += z * VAR(dc_cube_z);
return TRUE;
}

117
Plugin/dc_gridout.c Normal file
View File

@ -0,0 +1,117 @@
/*
Apophysis Plugin
Copyright (C) 2007-2008 Michael Faber
Copyright (C) 2007-2008 Joel Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define APO_NOVARIABLES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("dc_gridout");
inline double rint(double x)
{
int temp; temp = (x >= 0. ? (int)(x + 0.5) : (int)(x - 0.5));
return (double)temp;
}
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double x = rint(FTx);
double y = rint(FTy);
double c = TC;
if (y <= 0.0)
{
if (x > 0.0)
{
if (-y >= x)
{
FPx += VVAR * (FTx + 1.0);
FPy += VVAR * FTy;
c += 0.25;
}
else
{
FPx += VVAR * FTx;
FPy += VVAR * (FTy + 1.0);
c += 0.75;
}
}
else
{
if (y <= x)
{
FPx += VVAR * (FTx + 1.0);
FPy += VVAR * FTy;
c += 0.25;
}
else
{
FPx += VVAR * FTx;
FPy += VVAR * (FTy - 1.0);
c += 0.75;
}
}
}
else
{
if (x > 0.0)
{
if (y >= x)
{
FPx += VVAR * (FTx - 1.0);
FPy += VVAR * FTy;
c += 0.25;
}
else
{
FPx += VVAR * FTx;
FPy += VVAR * (FTy + 1.0);
c += 0.75;
}
}
else
{
if (y > -x)
{
FPx += VVAR * (FTx - 1.0);
FPy += VVAR * FTy;
c += 0.25;
}
else
{
FPx += VVAR * FTx;
FPy += VVAR * (FTy - 1.0);
c += 0.75;
}
}
}
TC = fmod(c, 1.0);
return TRUE;
}

52
Plugin/dc_linear.c Normal file
View File

@ -0,0 +1,52 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double dc_linear_offset, dc_linear_angle, dc_linear_scale;
double ldcs, ldca;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
APO_PLUGIN("dc_linear");
APO_VARIABLES(
VAR_REAL(dc_linear_offset, 0.0),
VAR_REAL(dc_linear_angle, 0.0),
VAR_REAL(dc_linear_scale, 1.0),
);
int PluginVarPrepare(Variation* vp)
{
VAR(ldcs) = 1.0 / (VAR(dc_linear_scale) == 0.0 ? 10E-6 : VAR(dc_linear_scale));
VAR(ldca) = VAR(dc_linear_offset) * M_PI;
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
FPx += VVAR * FTx;
FPy += VVAR * FTy;
FPz += VVAR * FTz;
double c, s; fsincos(VAR(dc_linear_angle), &s, &c);
TC = fmod( fabs( 0.5 * (VAR(ldcs) * ((c * FPx + s * FPy + VAR(dc_linear_offset))) + 1.0) ), 1.0 );
return TRUE;
}

301
Plugin/dc_mandelbrot.c Normal file
View File

@ -0,0 +1,301 @@
/*
Apophysis Plugin
Mandelbrot Set Plugin v2 - Copyright 2008,2009 Jed Kelsey
Changed to work with Apophysis 7X / DC in 2010 by Georg Kiehne
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
int dcm_iter;
int dcm_miniter;
int dcm_smooth_iter;
int dcm_retries;
int dcm_mode;
int dcm_pow;
int dcm_color_method;
double dcm_invert;
double dcm_xmin;
double dcm_xmax;
double dcm_ymin;
double dcm_ymax;
double dcm_scatter;
double dcm_sx;
double dcm_sy;
double dcm_zscale;
double x0, y0;
double zs, sc;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
APO_PLUGIN("dc_mandelbrot");
APO_VARIABLES(
VAR_INTEGER_RANGE(dcm_iter, 5, INT_MAX, 25),
VAR_INTEGER_RANGE(dcm_miniter, 0, INT_MAX, 1),
VAR_INTEGER_RANGE(dcm_smooth_iter, 0, INT_MAX, 0),
VAR_INTEGER_RANGE(dcm_retries, 0, INT_MAX, 50),
VAR_INTEGER_RANGE(dcm_mode, 0, 5, 0),
VAR_INTEGER_RANGE(dcm_pow, -6, 6, 2), // TODO: negative powers
VAR_INTEGER_RANGE(dcm_color_method, 0, 7, 0),
VAR_REAL_RANGE(dcm_invert, 0.0, 1.0, 0.0),
VAR_REAL(dcm_xmin, -2.0),
VAR_REAL(dcm_xmax, 2.0),
VAR_REAL(dcm_ymin, -1.5),
VAR_REAL(dcm_ymax, 1.5),
VAR_REAL_RANGE(dcm_scatter, -1000.0, 1000.0, 0.0),
// Following parameters don't affect iterations, just the output point positions.
VAR_REAL(dcm_sx, 0.0),
VAR_REAL(dcm_sy, 0.0),
VAR_REAL(dcm_zscale, 0.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(zs) = VVAR * VAR(dcm_zscale) / VAR(dcm_iter);
VAR(sc) = VAR(dcm_scatter) / 10.0;
return TRUE;
}
inline double fmod2(double h, double q) { return fmod(fabs(h),q); }
int PluginVarCalc(Variation* vp)
{
double x=0.0, y=0.0, x1=0.0, y1=0.0, x2, y2, xtemp=0.0;
double cx=0.0, cy=0.0;
int maxiter = VAR(dcm_iter);
int miniter = VAR(dcm_miniter); // = 0.1*(maxiter*(1-scatter));
double xmax = VAR(dcm_xmax);
double xmin = VAR(dcm_xmin);
double ymax = VAR(dcm_ymax);
double ymin = VAR(dcm_ymin);
int maxRetries = VAR(dcm_retries);
int mode = VAR(dcm_mode); /* 0=Mandelbrot, 1=Julia, 3=Tricorn(Mandelbar) */
int color_method = VAR(dcm_color_method);
double xp = 0.0, yp = 0.0;
int smooth_iter=0, max_smooth_iter=VAR(dcm_smooth_iter);
int inverted, iter=0, retries=0;
int isblur = (VAR(sc)>=0);
double smoothed_iter = 0.0, inv_iter = 1.0;
double mag2 = 0.0;
int m_power = VAR(dcm_pow);
int m_power_abs = ((m_power<0) ? -m_power : m_power);
inverted = random01() < VAR(dcm_invert);
if (!isblur) {
VAR(x0) = FTx;
VAR(y0) = FTy;
}
do {
if (VAR(sc)==0) {
// Force selection of point at random
VAR(x0) = VAR(y0) = 0;
}
if (VAR(x0)==0 && VAR(y0)==0) {
// Choose a point at random
VAR(x0) = (xmax-xmin)*random01() + xmin;
VAR(y0) = (ymax-ymin)*random01() + ymin;
} else {
// Choose a point close to previous point
VAR(x0) += VAR(sc)*(random01()-0.5);
VAR(y0) += VAR(sc)*(random01()-0.5);
}
// default to Mandelbrot Set
cx = x1 = x = xp = VAR(x0);
cy = y1 = y = yp = VAR(y0);
switch(mode) {
case 1: // Julia Set
cx = TM(e);
cy = TM(f);
break;
case 2: // tricorn (Mandelbar)
// leave as-is, handled below
break;
default: // Regular Mandelbrot set
// Leave as-is
break;
}
iter = smooth_iter = 0;
while ( (((x2=x*x) + (y2=y*y) < 4) && (iter < maxiter)) || (smooth_iter++<max_smooth_iter) ) {
if (smooth_iter==0)
xp=x; yp=y;
if (mode==2) y=-y;
switch(m_power_abs) {
case 3:
xtemp = x*(x2 - 3*y2) + cx;
y = y*(3*x2 - y2) + cy;
x = xtemp;
break;
case 4:
xtemp = (x2-y2)*(x2-y2)-4*x2*y2 + cx;
y = 4*x*y*(x2 - y2) + cy;
x = xtemp;
break;
case 5:
xtemp = x2*x2*x - 10*x2*x*y2 + 5*x*y2*y2 + cx;
y = 5*x2*x2*y - 10*x2*y2*y + y2*y2*y + cy;
x = xtemp;
break;
case 6:
xtemp = x2*x2*x2 - 15*x2*x2*y2 + 15*x2*y2*y2 - y2*y2*y2 + cx;
y = 6*x2*x2*x*y - 20*x2*x*y2*y + 6*x*y2*y2*y + cy;
x = xtemp;
break;
case 1:
if ((m_power>0) && (iter<maxiter)) // (more iterations not helpful)
iter = maxiter-1;
break;
case 2:
default:
xtemp = x2 - y2 + cx;
y = 2*x*y + cy;
x = xtemp;
break;
}
if ((m_power<0) && (xtemp=x2+y2)>0) {
x = x/xtemp;
y = -y/xtemp;
}
iter++;
}
iter -= (smooth_iter-1);
// could probably bypass check and always select next point at random
if ( (miniter==0) || (!inverted && (iter>=maxiter)) /*|| (iter < miniter)*/ ) {
VAR(x0) = VAR(y0) = 0; // Random point next time
} else if ( (iter < miniter) || (inverted && (iter<maxiter/2)) ) {
//if (retries>maxRetries-5) {
// VAR(x0) /= 100;
// VAR(y0) /= 100;
//} else
VAR(x0) = VAR(y0) = 0;
}
if (++retries > maxRetries)
break;
} while ((inverted && (iter < maxiter)) || (!inverted && ((iter >= maxiter) || ((miniter>0) && (iter < miniter)))));
smoothed_iter = iter;
if (max_smooth_iter>0) {
// use Normalized Iteration Count Algorithm for smoothing
mag2 = x2 + y2;
if (mag2 > 1.1) //FIXME: change this back to if(mag2>4) ?
smoothed_iter += 1 - log(log(mag2)/2)/M_LN2;
}
if (smoothed_iter>0)
inv_iter = 1/smoothed_iter;
else
inv_iter = 1;
// Adjust location of point according to sx,sy and final iterated point (x,y)
// (use of inv_iter reduces effect of factor near regions of high gradient
FPx += VVAR*(x1 + VAR(dcm_sx)*x*inv_iter);
FPy += VVAR*(y1 + VAR(dcm_sy)*y*inv_iter);
//FPx += VVAR*(x1 + VAR(dcm_sx)*x);
//FPy += VVAR*(y1 + VAR(dcm_sy)*y);
// TODO: add check to see whether this Apo supports 3D?
if (VAR(dcm_zscale)) {
FPz += smoothed_iter * VAR(zs);
}
// Allow plugin to influence coloring (-X- changed for Apo7X/DC)
if (smoothed_iter<0) smoothed_iter=0;
if (smoothed_iter>maxiter) smoothed_iter=maxiter;
switch (color_method) {
case 1:
// scale colormap indexing extent by the final angle of the iterated point
// after the extra "smoothing" iterations complete
xtemp = 0.0;
if (y != 0.0) xtemp = atan2(x,y) * M_1_2PI;
TC = fmod2(xtemp, 1);
break;
case 2:
// scale colormap indexing extent by the angle of the iterated point at time of escape
xtemp = 0.0;
if (yp != 0.0) xtemp = atan2(xp,yp) * M_1_2PI;
TC = fmod2(xtemp, 1);
break;
case 3:
// combination of mode 4 and 2
xtemp = 0.0;
if (y-yp != 0.0) xtemp = atan2(x-xp,y-yp) * M_1_2PI;
TC = fmod2((smoothed_iter/maxiter * xtemp), 1);
break;
case 4:
// scale colormap indexing extent by the product of the scaled iteration count and
// the angle of the iterated point at time of escape
xtemp = 0.0;
if (yp != 0.0) xtemp = atan2(xp,yp) * M_1_2PI;
TC = fmod2((smoothed_iter/maxiter * xtemp), 1);
break;
case 5:
// scale colormap indexing extent by a combination of scaled iteration count,
// the squared magnitude and adjusted angle of the iterated point at time of escape
xtemp = 0.0;
if (yp != 0.0) xtemp = (0.5 + atan2(xp,yp) * M_1_2PI) * (xp*xp+yp*yp);
TC = fmod2((smoothed_iter/maxiter * xtemp), 1);
break;
case 6:
// scale colormap indexing extent by a combination of scaled iteration count and
// the squared magnitude of the iterated point at time of escape
xtemp = xp*xp+yp*yp;
TC = fmod2((smoothed_iter/maxiter * xtemp), 1);
break;
case 7:
// scale colormap indexing extent by a combination of scaled iteration count and
// the squared magnitude of the iterated point at time of escape
// (slightly more relaxed color rolloff than case 6)
xtemp = sqrt(xp*xp+yp*yp);
TC = fmod2((smoothed_iter/maxiter * xtemp), 1);
break;
case 0:
// default coloring method: scale colormap indexing extent by the scaled "escape time"
// (iteration count)
default:
TC = fmod2(smoothed_iter/maxiter, 1);
break;
}
return TRUE;
}

102
Plugin/dc_triangle.c Normal file
View File

@ -0,0 +1,102 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double dc_triangle_scatter_area, A;
int dc_triangle_zero_edges;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("dc_triangle");
APO_VARIABLES(
VAR_REAL(dc_triangle_scatter_area, 0.0),
VAR_INTEGER_RANGE(dc_triangle_zero_edges, 0, 1, 0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(A) = VAR(dc_triangle_scatter_area) < -1 ? -1 :
VAR(dc_triangle_scatter_area) > 1 ? 1 :
VAR(dc_triangle_scatter_area);
return TRUE;
}
/* This function is called during calculation.
You must call the argument "vp"
*/
int PluginVarCalc(Variation* vp)
{
// set up triangle
const double
xx = TM(a), xy = TM(b), // X
yx = TM(c) * -1, yy = TM(d) * -1, // Y
ox = TM(e), oy = TM(f), // O
px = FTx - ox, py = FTy - oy; // P
// calculate dot products
const double dot00 = xx * xx + xy * xy; // X * X
const double dot01 = xx * yx + xy * yy; // X * Y
const double dot02 = xx * px + xy * py; // X * P
const double dot11 = yx * yx + yy * yy; // Y * Y
const double dot12 = yx * px + yy * py; // Y * P
// calculate barycentric coordinates
const double denom = (dot00 * dot11 - dot01 * dot01);
const double num_u = (dot11 * dot02 - dot01 * dot12);
const double num_v = (dot00 * dot12 - dot01 * dot02);
// u, v must not be constant
double u = num_u / denom;
double v = num_v / denom;
int inside = 0, f = 1;
// case A - point escapes edge XY
if (u + v > 1) { f = -1;
if (u > v) { u = u>1?1:u; v = 1-u; }
else { v = v>1?1:v; u = 1-v; } }
// case B - point escapes either edge OX or OY
else if ((u < 0) || (v < 0)) {
u = u<0?0:u>1?1:u; v = v<0?0:v>1?1:v; }
// case C - point is in triangle
else inside = 1;
// handle outside points
if (VAR(dc_triangle_zero_edges) && !inside) u = v = 0;
else if (!inside) {
u = (u + random01() * VAR(A) * f);
v = (v + random01() * VAR(A) * f);
u = u<-1?-1:u>1?1:u; v = v<-1?-1:v>1?1:v;
if ((u + v > 1) && (VAR(A) > 0))
if (u > v) { u = u>1?1:u; v = 1-u; }
else { v = v>1?1:v; u = 1-v; }
}
// set output
FPx += VVAR * (ox + u * xx + v * yx);
FPy += VVAR * (oy + u * xy + v * yy);
FPz += VVAR * FTz;
TC = fmod(fabs(u+v),1.0);
// done
return TRUE;
}

69
Plugin/dc_ztransl.c Normal file
View File

@ -0,0 +1,69 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Written by Georg Kiehne
--> http://xyrus-worx.net, http://xyrus02.deviantart.com
If you find any bugs / nags - keep them :)
*/
typedef struct {
double dc_ztransl_x0;
double dc_ztransl_x1;
double dc_ztransl_factor;
double x0_, x1_, x1_m_x0;
int dc_ztransl_overwrite;
int dc_ztransl_clamp;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("dc_ztransl");
APO_VARIABLES(
VAR_REAL_RANGE(dc_ztransl_x0, 0.0, 1.0, 0.0),
VAR_REAL_RANGE(dc_ztransl_x1, 0.0, 1.0, 1.0),
VAR_REAL(dc_ztransl_factor, 1.0),
VAR_INTEGER_RANGE(dc_ztransl_overwrite, 0, 1, 1),
VAR_INTEGER_RANGE(dc_ztransl_clamp, 0, 1, 0)
);
int PluginVarPrepare(Variation* vp)
{
vp->var.x0_ = vp->var.dc_ztransl_x0 < vp->var.dc_ztransl_x1 ? vp->var.dc_ztransl_x0 : vp->var.dc_ztransl_x1;
vp->var.x1_ = vp->var.dc_ztransl_x0 > vp->var.dc_ztransl_x1 ? vp->var.dc_ztransl_x0 : vp->var.dc_ztransl_x1;
vp->var.x1_m_x0 = vp->var.x1_ - vp->var.x0_ == 0 ? EPS : vp->var.x1_ - vp->var.x0_;
return 1;
}
inline double flip(double a, double b, double c){return (c*(b-a)+a);}
int PluginVarCalc(Variation* vp)
{
double zf = vp->var.dc_ztransl_factor * (*(vp->pColor) - vp->var.x0_) / vp->var.x1_m_x0;
if (vp->var.dc_ztransl_clamp != 0)
zf = zf < 0 ? 0 : zf > 1 ? 1 : zf;
*(vp->pFPx) += vp->vvar*(*(vp->pFTx));
*(vp->pFPy) += vp->vvar*(*(vp->pFTy));
if (vp->var.dc_ztransl_overwrite == 0)
*(vp->pFPz) += vp->vvar*(*(vp->pFTz))*zf;
else *(vp->pFPz) += vp->vvar*zf;
return 1;
}

57
Plugin/deltaA.c Normal file
View File

@ -0,0 +1,57 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double v;
} Variables;
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#define APO_VIRTUALVAR
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("deltaA");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(v) = 0.5 * VVAR / M_PI;
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double avgr, avga;
double s, c;
avgr = VVAR * (sqrt(sqr(FTy) + sqr(FTx + 1.0)) / sqrt(sqr(FTy) + sqr(FTx - 1.0)));
avga = (atan2( FTy, FTx - 1.0) - atan2(FTy, FTx + 1.0) )/ 2.0;
fsincos( avga, &s, &c);
FPx += avgr * c;
FPy += avgr * s;
return TRUE;
}

64
Plugin/edisc.c Normal file
View File

@ -0,0 +1,64 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double edisc_vvar;
} Variables;
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#define APO_VIRTUALVAR
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("edisc");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(edisc_vvar) = VVAR / 11.57034632;
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double tmp = FTy * FTy + FTx * FTx + 1.0;
double tmp2 = 2.0 * FTx;
double r1 = sqrt(tmp + tmp2);
double r2 = sqrt(tmp - tmp2);
double xmax = (r1 + r2) * 0.5;
double snv, csv, snhu, cshu;
double expu, expuinv;
fsincos(log(xmax + sqrt(xmax - 1.0)), &snv, &csv);
sinhcosh(-acos(FTx / xmax), &snhu, &cshu);
if (FTy > 0.0)
snv = -snv;
FPx += VAR(edisc_vvar) * cshu * csv;
FPy += VAR(edisc_vvar) * snhu * snv;
return TRUE;
}

53
Plugin/ex.c Normal file
View File

@ -0,0 +1,53 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#include "apoplugin.h"
/* SET PLUGIN NAME HERE:
e.g. name-me
*/
APO_PLUGIN("ex");
/* DO PREPARE STUFF HERE:
You must call the argument "vp"
*/
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
/* DO CALC STUFF HERE:
You must call the argument "vp"
*/
int PluginVarCalc(Variation* vp)
{
double FAngle = atan2(FTy, FTx);
double r = sqrt(FTx*FTx+FTy*FTy);
double n0 = sin(FAngle + r);
double n1 = cos(FAngle - r);
double m0 = sqr(n0) * n0;
double m1 = sqr(n1) * n1;
r = r * VVAR;
FPx = FPx + r * (m0 + m1);
FPy = FPy + r * (m0 - m1);
return TRUE;
}

92
Plugin/expo.c Normal file
View File

@ -0,0 +1,92 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
// expo_real represents the real part of the base (a)
double expo_real;
// expo_imaginary represents the imaginary part of the base (b)
double expo_imaginary;
double expo_k;
double expo_t;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("expo");
// Define the Variables
APO_VARIABLES(
VAR_REAL(expo_real, -1.0),
VAR_REAL(expo_imaginary, 1.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
double ereal = VAR(expo_real);
double eimag = VAR(expo_imaginary);
VAR(expo_k) = 0.5 * log(ereal * ereal + eimag * eimag + 1e-300);
VAR(expo_t) = atan2(eimag,ereal);
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double expor = exp(FTx * VAR(expo_k) - FTy * VAR(expo_t));
double snv, csv;
fsincos(FTx * VAR(expo_t) + FTy * VAR(expo_k), &snv, &csv);
FPx += VVAR * expor * csv;
FPy += VVAR * expor * snv;
return TRUE;
}
// Given the equation (a + ib)^z, or c^z, where c = a + ib...
// We can rewrite it as e^(ln(c^z))...
// Using the laws of Logs, we get e^(z * ln(c))...
// The ln of a complex number is ln(r) + itheta, where
// r is the radius and theta is the angle. Thus, we need
// the radius and angle of our base number c.
// k is what I've used to represent the radius of the number
// c, or a + ib. t is used to represent the angle.
// Thus, expok is the radius of c and expot is the angle.
// Now we have e^(z * (ln(k) + it)), or e^((x + iy) * (ln(k) + it))
// Simplifying this down, we get...
// e^(xln(k) - yt) * e^i(xt + yln(k))
// Because a Complex Number can be presented as
// r * e^itheta, where r is the radius and theta is the angle,
// We can say that r' = e^(xln(k) - yt)
// And that theta' = xt + yln(k)
// For optimization (as recommended by Joel) we calculate k,
// the radius of our complex number, as the ln of k,
// because we never need k to be on its own (it is always
// logged before it is used).
// That's the equation!

38
Plugin/extrude.c Normal file
View File

@ -0,0 +1,38 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct {
double extrude_root_face;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("extrude");
APO_VARIABLES(
VAR_REAL(extrude_root_face, 0.5)
);
int PluginVarPrepare(Variation* vp) { return TRUE; }
int PluginVarCalc(Variation* vp)
{
if ((((rand() ^ (rand()<<15)) & 0xfffffff) / (double) 0xfffffff) < vp->var.extrude_root_face)
FPz = (vp->vvar<0?0:vp->vvar);
else FPz = vp->vvar * (((rand() ^ (rand()<<15)) & 0xfffffff) / (double) 0xfffffff);
return TRUE;
}

48
Plugin/fdisc.c Normal file
View File

@ -0,0 +1,48 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("fdisc");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double c, s;
double a = M_2PI /(sqrt(sqr(FTx) + sqr(FTy)) + 1.0);
double r = (atan2(FTy, FTx) * M_1_PI + 1.0) * 0.5;
fsincos( a, &s, &c);
FPx += VVAR * r * c;
FPy += VVAR * r * s;
return TRUE;
}

81
Plugin/fibonacci.c Normal file
View File

@ -0,0 +1,81 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double ffive;
double fnatlog;
} Variables;
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#define APO_VIRTUALVAR
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("fibonacci");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
// Updated to use the new constants. Still calculates
// invserse of root five and the nat log of the Golden Ratio.
// I'm not sure how many decimal places were appropriate,
// or how many C allows, and this isn't going to take
// up any noticeable amount of time.
VAR(ffive) = 1/M_SQRT5;
VAR(fnatlog) = log(M_PHI);
// Always return TRUE.
return TRUE;
}
// p^z - (-p)^(-z)
// z' = -----------------
// sqrt(5)
//
// Where p is the Golden Ratio.
// This function generates the fibonacci sequence
// for real integer values.
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 < Real Value
// 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 < Fib Value
//
// Negative real integers produce the negative fibonacci sequence,
// which is the same as the normal one, except every
// other number is negative.
// 1 0 -1 -2 -3 -4 -5 -6 -7 -8 < Real Value
// 1 0 1 -1 3 -3 5 -8 13 -21 < Fib Value
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double snum1, cnum1, snum2, cnum2;
fsincos(FTy * VAR(fnatlog), &snum1, &cnum1);
fsincos((FTx * M_PI + FTy * VAR(fnatlog)) * -1, &snum2, &cnum2);
double eradius1 = exp(FTx * VAR(fnatlog));
double eradius2 = exp((FTx * VAR(fnatlog) - FTy * M_PI) * -1);
FPx += VVAR * (eradius1 * cnum1 - eradius2 * cnum2) * VAR(ffive);
FPy += VVAR * (eradius1 * snum1 - eradius2 * snum2) * VAR(ffive);
return TRUE;
}

45
Plugin/fisheye.c Normal file
View File

@ -0,0 +1,45 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#include "apoplugin.h"
/* SET PLUGIN NAME HERE:
e.g. name-me
*/
APO_PLUGIN("fisheye");
/* DO PREPARE STUFF HERE:
You must call the argument "vp"
*/
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
/* DO CALC STUFF HERE:
You must call the argument "vp"
*/
int PluginVarCalc(Variation* vp)
{
double r = 2 * VVAR / (sqrt(FTx * FTx + FTy * FTy) + 1);
FPx = FPx + r * FTy;
FPy = FPy + r * FTx;
return TRUE;
}

81
Plugin/flux.c Normal file
View File

@ -0,0 +1,81 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
09-10-04 - Optimized by Xyrus02
*/
typedef struct
{
//double v;
double spr;
double flux_spread;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("flux");
APO_VARIABLES(
VAR_REAL(flux_spread, 0.0),
);
int PluginVarPrepare(Variation* vp)
{
// Why is this calculated? It isn't used...
//VAR(v) = 0.5 * VVAR / M_PI;
// But we only use 2 + VAR(flux_spread) so we can precalculate that :-)
VAR(spr) = 2 + VAR(flux_spread);
// We succeeded :-)
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double avgr, avga;
double s, c;
// Avoid reduant calculations by precalculating everything what is used at least twice
double x = FTx,
y = FTy;
double xpv = FTx + VVAR,
xmv = FTx - VVAR;
double y2 = sqr(y);
// We have a division by zero problem in the original flux
// (What if y + (x-vvar) == 0 ????)
double frac = sqrt(y2 + sqr(xmv));
if (frac == 0) frac = 1.0;
// This is a huge shitload of calculations :O
avgr = VVAR * (VAR(spr) * sqrt(sqrt(y2 + sqr(xpv) ) / frac));
avga = (atan2(y , xmv) - atan2(y , xpv)) / 2.0;
fsincos(avga, &s, &c);
FPx += avgr * c;
FPy += avgr * s;
// Add 3D compatibility
FPz += FTz;
// Report success!
return TRUE;
}

99
Plugin/gdoffs.c Normal file
View File

@ -0,0 +1,99 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Written by Georg Kiehne
--> http://xyrus-worx.net, http://xyrus02.deviantart.com
If you find any bugs / nags - keep them :)
*/
typedef struct {
double gdoffs_delta_x, gdoffs_delta_y;
double gdoffs_area_x, gdoffs_area_y;
double gdoffs_center_x, gdoffs_center_y;
int gdoffs_gamma, gdoffs_square;
double gdodx, gdoax, gdocx;
double gdody, gdoay, gdocy;
double gdob;
int gdog, gdos;
} Variables;
#include "apoplugin.h"
// Fine tune stuff, try not to touch :)
const double __agdod = 0.1;
const double __agdoa = 2.0;
const double __agdoc = 1.0;
APO_PLUGIN("gdoffs");
APO_VARIABLES(
VAR_REAL_RANGE(gdoffs_delta_x, 0.0, 16.0, 0.0),
VAR_REAL_RANGE(gdoffs_delta_y, 0.0, 16.0, 0.0),
VAR_REAL(gdoffs_area_x, 2.0),
VAR_REAL(gdoffs_area_y, 2.0),
VAR_REAL(gdoffs_center_x, 0.0),
VAR_REAL(gdoffs_center_y, 0.0),
VAR_INTEGER_RANGE(gdoffs_gamma, 1, 6, 1),
VAR_INTEGER_RANGE(gdoffs_square, 0, 1, 0)
);
int PluginVarPrepare(Variation* vp)
{
vp->var.gdodx = (vp->var.gdoffs_delta_x) * __agdod;
vp->var.gdody = (vp->var.gdoffs_delta_y) * __agdod;
vp->var.gdoax = ((fabs(vp->var.gdoffs_area_x) < 0.1) ? 0.1 : fabs(vp->var.gdoffs_area_x)) * __agdoa;
vp->var.gdoay = ((fabs(vp->var.gdoffs_area_y) < 0.1) ? 0.1 : fabs(vp->var.gdoffs_area_y)) * __agdoa;
vp->var.gdocx = (vp->var.gdoffs_center_x) * __agdoc;
vp->var.gdocy = (vp->var.gdoffs_center_y) * __agdoc;
vp->var.gdog = (vp->var.gdoffs_gamma);
vp->var.gdos = (vp->var.gdoffs_square);
vp->var.gdob = (double)(vp->var.gdog) * __agdoa / (MAX(vp->var.gdoax, vp->var.gdoay));
return 1;
}
inline double fcip(double a){return ((a<0)?-((int)(fabs(a))+1):0)+((a>1)?((int)(a)):0);}
inline double fclp(double a){return ((a<0)?-(fmod(fabs(a),1)):fmod(fabs(a),1));}
inline double fscl(double a){return fclp((a+1)/2); }
inline double fosc(double p, double a){return fscl(-1*cos(p*a*M_2PI));}
inline double flip(double a, double b, double c){return (c*(b-a)+a);}
int PluginVarCalc(Variation* vp)
{
double osc_x=fosc(vp->var.gdodx,1),osc_y=fosc(vp->var.gdody,1);
double in_x=(*(vp->pFTx)+vp->var.gdocx),in_y=(*(vp->pFTy)+vp->var.gdocy);
double out_x=0,out_y=0;
if ((vp->var.gdos) != 0) {
out_x = flip(flip(in_x,fosc(in_x,4),osc_x),fosc(fclp(vp->var.gdob*in_x),4),osc_x);
out_y = flip(flip(in_y,fosc(in_y,4),osc_x),fosc(fclp(vp->var.gdob*in_y),4),osc_x);
} else {
out_x = flip(flip(in_x,fosc(in_x,4),osc_x),fosc(fclp(vp->var.gdob *in_x),4),osc_x);
out_y = flip(flip(in_y,fosc(in_y,4),osc_y),fosc(fclp(vp->var.gdob *in_y),4),osc_y);
}
*(vp->pFPx) = vp->vvar*out_x;
*(vp->pFPy) = vp->vvar*out_y;
*(vp->pFPz) = vp->vvar*(*(vp->pFTz));
return 1;
}

87
Plugin/glynnia.c Normal file
View File

@ -0,0 +1,87 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double vvar2;
} Variables;
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#define APO_VIRTUALVAR
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("glynnia");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(vvar2) = VVAR * sqrt(2.0) / 2.0;
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double r = sqrt(sqr(FTx) + sqr(FTy));
double d;
if( r > 1.0)
{
if( random01() > 0.5)
{
d = sqrt(r + FTx);
FPx += VAR(vvar2) * d;
FPy -= VAR(vvar2) / d * FTy; //+= VAR(vvar2) / d * FTy;
}
else
{
d = r + FTx;
r = VVAR / sqrt(r * ( sqr(FTy) + sqr(d)));
FPx += r * d;
FPy += r * FTy; //-= r * FTy;
}
}
else
{
if( random01() > 0.5)
{
d = sqrt(r + FTx);
FPx -= VAR(vvar2) * d;
FPy -= VAR(vvar2) / d * FTy;
}
else
{
d = r + FTx;
r = VVAR / sqrt(r * ( sqr(FTy) + sqr(d)));
FPx -= r * d;
FPy += r * FTy;
}
}
return TRUE;
}

108
Plugin/gridout.c Normal file
View File

@ -0,0 +1,108 @@
/*
Apophysis Plugin
Copyright (C) 2007-2008 Michael Faber
Copyright (C) 2007-2008 Joel Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("gridout");
inline double rint(double x)
{
int temp; temp = (x >= 0. ? (int)(x + 0.5) : (int)(x - 0.5));
return (double)temp;
}
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double x = rint(FTx);
double y = rint(FTy);
if (y <= 0.0)
{
if (x > 0.0)
{
if (-y >= x)
{
FPx += VVAR * (FTx + 1.0);
FPy += VVAR * FTy;
}
else
{
FPx += VVAR * FTx;
FPy += VVAR * (FTy + 1.0);
}
}
else
{
if (y <= x)
{
FPx += VVAR * (FTx + 1.0);
FPy += VVAR * FTy;
}
else
{
FPx += VVAR * FTx;
FPy += VVAR * (FTy - 1.0);
}
}
}
else
{
if (x > 0.0)
{
if (y >= x)
{
FPx += VVAR * (FTx - 1.0);
FPy += VVAR * FTy;
}
else
{
FPx += VVAR * FTx;
FPy += VVAR * (FTy + 1.0);
}
}
else
{
if (y > -x)
{
FPx += VVAR * (FTx - 1.0);
FPy += VVAR * FTy;
}
else
{
FPx += VVAR * FTx;
FPy += VVAR * (FTy - 1.0);
}
}
}
return TRUE;
}

47
Plugin/handkerchief.c Normal file
View File

@ -0,0 +1,47 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#include "apoplugin.h"
/* SET PLUGIN NAME HERE:
e.g. name-me
*/
APO_PLUGIN("handkerchief");
/* DO PREPARE STUFF HERE:
You must call the argument "vp"
*/
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
/* DO CALC STUFF HERE:
You must call the argument "vp"
*/
int PluginVarCalc(Variation* vp)
{
double r = sqrt(FTx*FTx + FTy*FTy);
double FAngle = atan2(FTy, FTx);
FPx = FPx + VVAR * sin(FAngle + r) * r;
FPy = FPy + VVAR * cos(FAngle - r) * r;
return TRUE;
}

289
Plugin/hexes.c Normal file
View File

@ -0,0 +1,289 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// "Hexes" variation breaks plane into hexagonal cells and applies same
// power, scaling, rotation.
// voronoi is additional, not required in all Apophysis plugins
#define VORONOI_MAXPOINTS 25
double vratio( double P[2], double Q[2], double U[2] );
int closest( double P[VORONOI_MAXPOINTS][2], int n, double U[2] );
double voronoi( double P[VORONOI_MAXPOINTS][2], int n, int q, double U[2] );
// Cheap and cheerful vector definitions for 3D :-)
// They just make reading vector code based on arrays
// slightly nicer for me! E.g. use V[_x_] instead of V[0].
#define _x_ 0
#define _y_ 1
#define _z_ 2
// Must define this structure before we include apoplugin.h
typedef struct
{
double hexes_cellsize;
double hexes_power;
double hexes_rotate;
double hexes_scale;
// P is a working list of points
double P[VORONOI_MAXPOINTS][2];
double rotSin;
double rotCos;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("hexes");
// Define the Variables
APO_VARIABLES(
VAR_REAL(hexes_cellsize, 1.0),
VAR_REAL(hexes_power, 1.0),
VAR_REAL(hexes_rotate, 0.166),
VAR_REAL(hexes_scale, 1.0)
);
// Following are pre-calculated fixed multipliers for converting
// between "Hex" co-ordinates and "Original" co-ordinates.
// Xh = (Xo + sqrt(3) * Yo) / (3 * l)
static const double AXhXo = 1.0/3.0;
static const double AXhYo = 1.7320508075688772935/3.0;
// Now: Xh = ( AXhXo * Xo + AXhYo * Yo ) / l;
// Yh = (-Xo + sqrt(3) * Yo) / (3 * l)
static const double AYhXo = -1.0/3.0;
static const double AYhYo = 1.7320508075688772935/3.0;
// Now: Yh = ( AYhXo * Xo + AYhYo * Yo ) / l;
// Xo = 3/2 * l * (Xh - Yh)
static const double AXoXh = 1.5;
static const double AXoYh = -1.5;
// Now: Xo = ( AXoXh * Xh + AXoYh * Yh ) * l;
// Yo = sqrt(3)/2 * l * (Xh + Yh)
static const double AYoXh = 1.7320508075688772935/2.0;
static const double AYoYh = 1.7320508075688772935/2.0;
// Now: Yo = ( AYoXh * Xh + AYoYh * Yh ) * l;
double vratio( double P[2], double Q[2], double U[2] ) {
double PmQx, PmQy;
PmQx = P[_x_] - Q[_x_];
PmQy = P[_y_] - Q[_y_];
if ( 0.0 == PmQx && 0.0 == PmQy ) {
return 1.0;
}
return 2.0 * ( ( U[_x_] - Q[_x_] ) * PmQx + ( U[_y_] - Q[_y_] ) * PmQy ) / ( PmQx * PmQx + PmQy * PmQy );
}
// Closest point to U from array P.
// P is an array of points
// n is number of points to check
// U is location to find closest
int closest( double P[VORONOI_MAXPOINTS][2], int n, double U[2] ) {
double d2;
double d2min = 1.0e100;
int i, j;
for( i = 0; i < n; i++ ) {
d2 = (P[i][_x_] - U[_x_]) * (P[i][_x_] - U[_x_]) + (P[i][_y_] - U[_y_]) * (P[i][_y_] - U[_y_]);
if ( d2 < d2min ) {
d2min = d2;
j = i;
}
}
return j;
}
// Voronoi "value" is 0.0 (centre) to 1.0 (edge) if inside cell . . . higher values
// mean that point is not in the cell defined by chosen centre.
// P is an array of points defining cell centres
// n is number of points in array
// q is chosen centre to measure distance from
// U is point to test
double voronoi( double P[VORONOI_MAXPOINTS][2], int n, int q, double U[2] ) {
double ratio;
double ratiomax = -1.0e100;
int i;
for( i = 0; i < n; i++ ) {
if ( i != q ) {
ratio = vratio( P[i], P[q], U );
if ( ratio > ratiomax ) {
ratiomax = ratio;
}
}
}
return ratiomax;
}
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
// Pre-calculate rotation matrix, to save time later . . .
VAR(rotSin) = sin( VAR(hexes_rotate) * 2 * M_PI );
VAR(rotCos) = cos( VAR(hexes_rotate) * 2 * M_PI );
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double XCh, YCh, XCo, YCo, DXo, DYo, L, L1, L2, R, R1, R2, s, trgL, Vx, Vy;
double U[2];
// For speed/convenience
s = VAR(hexes_cellsize);
// Infinite number of small cells? No effect . . .
if ( 0.0 == s ) {
return TRUE;
}
// Get co-ordinates, and convert to hex co-ordinates
U[_x_] = FTx;
U[_y_] = FTy;
XCh = floor( ( AXhXo * U[_x_] + AXhYo * U[_y_] ) / s );
YCh = floor( ( AYhXo * U[_x_] + AYhYo * U[_y_] ) / s );
// Get a set of 4 hex centre points, based around the one above
int i = 0;
double di, dj;
for (di = XCh; di < XCh + 1.1; di += 1.0) {
for (dj = YCh; dj < YCh + 1.1; dj += 1.0) {
VAR(P)[i][_x_] = (AXoXh * di + AXoYh * dj ) * s;
VAR(P)[i][_y_] = (AYoXh * di + AYoYh * dj ) * s;
i++;
}
}
int q = closest( VAR(P), 4, U );
double offset[4][2] = { { 0.0, 0.0}, { 0.0, 1.0},
{ 1.0, 0.0}, { 1.0, 1.0}
};
// Remake list starting from chosen hex, ensure it is completely surrounded (total 7 points)
// First adjust centres according to which one was found to be closest
XCh += offset[q][_x_];
YCh += offset[q][_y_];
// First point is central/closest
XCo = (AXoXh * XCh + AXoYh * YCh ) * s;
YCo = (AYoXh * XCh + AYoYh * YCh ) * s;
VAR(P)[0][_x_] = XCo;
VAR(P)[0][_y_] = YCo;
// Next six points are based on hex graph (6 hexes around centre). As long as
// centre points are not too distorted from simple hex, this defines all possible edges
// In hex co-ords, offsets are: (0,1) (1,1) (1,0) (0,-1) (-1,-1) (-1, 0)
VAR(P)[1][_x_] = XCo + ( AXoYh ) * s;
VAR(P)[1][_y_] = YCo + ( AYoYh ) * s;
VAR(P)[2][_x_] = XCo + ( AXoXh + AXoYh ) * s;
VAR(P)[2][_y_] = YCo + ( AYoXh + AYoYh ) * s;
VAR(P)[3][_x_] = XCo + ( AXoXh ) * s;
VAR(P)[3][_y_] = YCo + ( AYoXh ) * s;
VAR(P)[4][_x_] = XCo - AXoYh * s;
VAR(P)[4][_y_] = YCo - AYoYh * s;
VAR(P)[5][_x_] = XCo - ( AXoXh + AXoYh ) * s;
VAR(P)[5][_y_] = YCo - ( AYoXh + AYoYh ) * s;
VAR(P)[6][_x_] = XCo - AXoXh * s;
VAR(P)[6][_y_] = YCo - AYoXh * s;
L1 = voronoi( VAR(P), 7, 0, U );
// Delta vector from centre of hex
DXo = U[_x_] - VAR(P)[0][_x_];
DYo = U[_y_] - VAR(P)[0][_y_];
/////////////////////////////////////////////////////////////////
// Apply "interesting bit" to cell's DXo and DYo co-ordinates
// trgL is the defined value of l, independent of any rotation
trgL = pow( L1 + 1e-100, VAR(hexes_power) ) * VAR(hexes_scale);
// Rotate
Vx = DXo * VAR(rotCos) + DYo * VAR(rotSin);
Vy = -DXo * VAR(rotSin) + DYo * VAR(rotCos);
//////////////////////////////////////////////////////////////////
// Measure voronoi distance again
U[_x_] = Vx + VAR(P)[0][_x_];
U[_y_] = Vy + VAR(P)[0][_y_];
L2 = voronoi( VAR(P), 7, 0, U );
//////////////////////////////////////////////////////////////////
// Scale to meet target size . . . adjust according to how close
// we are to the edge
// Code here attempts to remove the "rosette" effect caused by
// scaling between
// L is maximum of L1 or L2 . . .
// When L = 0.8 or higher . . . match trgL/L2 exactly
// When L = 0.5 or less . . . match trgL/L1 exactly
R1 = trgL / ( L1 + 1e-100 );
R2 = trgL / ( L2 + 1e-100 );
L = ( L1 > L2 ) ? L1 : L2;
if ( L < 0.5 ) {
R = trgL / L1;
} else {
if ( L > 0.8 ) {
R = trgL / L2;
} else {
R = ( ( trgL / L1 ) * ( 0.8 - L ) + ( trgL / L2 ) * ( L - 0.5 ) ) / 0.3;
}
}
Vx *= R;
Vy *= R;
// Add cell centre co-ordinates back in
Vx += VAR(P)[0][_x_];
Vy += VAR(P)[0][_y_];
// Finally add values in
FPx += VVAR * Vx;
FPy += VVAR * Vy;
return TRUE;
}

114
Plugin/hole.c Normal file
View File

@ -0,0 +1,114 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double hole_a;
int hole_inside;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("hole");
// Define the Variables
APO_VARIABLES(
VAR_REAL(hole_a, 1.0),
VAR_INTEGER_RANGE( hole_inside, 0, 1, 0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
/* double a = atan2(FTy, FTx);
double r = VVAR * sqrt(sqr(FTx) + sqr(FTy) + pow( a/M_PI + 1.0, VAR(hole_a)));
double s, c;
fsincos( a, &s, &c);
FPx += r * c;
FPy += r * s;
*/
double a = atan2(FTy, FTx);
double delta = pow( a/M_PI + 1.0, VAR(hole_a));
double r;
if(VAR(hole_inside))
{
r = VVAR * delta / ( sqrt(sqr(FTx) + sqr(FTy)) + delta );
}
else
{
r = VVAR * sqrt(sqr(FTx) + sqr(FTy)) + delta ;
}
double s, c;
fsincos( a, &s, &c);
FPx += r * c;
FPy += r * s;
/* heart 2
double a = atan2(FTy, FTx);
double r = VVAR * sqrt(sqr(FTx) + sqr(FTy) + sqr(a) + 0.0 );
double s, c;
fsincos( a, &s, &c);
FPx += r * c;
FPy += r * s;
double a = atan2(FTy, FTx);
double r = VVAR * sqrt(sqr(FTx) + sqr(FTy) + fabs(tan(a)) );
double s, c;
fsincos( a, &s, &c);
FPx += r * c;
FPy += r * s;
/* heart
double a = atan2(FTy, FTx);
double r = VVAR * sqrt(sqr(FTx) + sqr(FTy) + sin(a) + 1.0 );
double s, c;
fsincos( a, &s, &c);
FPx += r * c;
FPy += r * s;
*/
/* two hole
double a = atan2(FTy, FTx);
double r = VVAR * sqrt(sqr(FTx) + sqr(FTy) + sin(2.0 * a) + 1.0 );
double s, c;
fsincos( a, &s, &c);
FPx += r * c;
FPy += r * s;
*/
return TRUE;
}

79
Plugin/hypertile.c Normal file
View File

@ -0,0 +1,79 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
int hypertile_p, hypertile_q, hypertile_n;
double re, im;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("hypertile");
// Define the Variables
APO_VARIABLES(
VAR_INTEGER_RANGE(hypertile_p, 3, 0x7fffffff, 3),
VAR_INTEGER_RANGE(hypertile_q, 3, 0x7fffffff, 7),
VAR_INTEGER(hypertile_n, 0),
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
double pa = 2*M_PI / VAR(hypertile_p),
qa = 2*M_PI / VAR(hypertile_q);
double r = (1 - cos(pa)) / (cos(pa) + cos(qa)) + 1;
if (r > 0)
r = 1 / sqrt(r);
else
r = 1;
double a = VAR(hypertile_n) * pa;
VAR(re) = r * cos(a);
VAR(im) = r * sin(a);
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double a = FTx + VAR(re),
b = FTy - VAR(im);
double c = VAR(re)*FTx - VAR(im)*FTy + 1,
d = VAR(re)*FTy + VAR(im)*FTx;
double vr = VVAR / (sqr(c) + sqr(d));
FPx += vr * (a*c + b*d);
FPy += vr * (b*c - a*d);
return TRUE;
}

55
Plugin/idisc.c Normal file
View File

@ -0,0 +1,55 @@
/*
Apophysis Plugin
Copyright (C) 2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double v;
} Variables;
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#define APO_VIRTUALVAR
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("idisc");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(v) = VVAR * M_1_PI;
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double c, s;
double a = M_PI /(sqrt(sqr(FTx) + sqr(FTy)) + 1.0);
double r = atan2(FTy, FTx) * VAR(v);
fsincos(a, &s, &c);
FPx += r * c;
FPy += r * s;
return TRUE;
}

74
Plugin/julian2.c Normal file
View File

@ -0,0 +1,74 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double julian2_a;
double julian2_b;
double julian2_c;
double julian2_d;
double julian2_e;
double julian2_f;
int julian2_power;
double julian2_dist;
int absN;
double cN;
double vvar2;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("julian2");
APO_VARIABLES(
VAR_INTEGER_NONZERO(julian2_power, 2),
VAR_REAL(julian2_dist, 1.0),
VAR_REAL(julian2_a, 1.0),
VAR_REAL(julian2_b, 0.0),
VAR_REAL(julian2_c, 0.0),
VAR_REAL(julian2_d, 1.0),
VAR_REAL(julian2_e, 0.0),
VAR_REAL(julian2_f, 0.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(absN) = (int)abs(VAR(julian2_power));
VAR(cN) = VAR(julian2_dist) / VAR(julian2_power) / 2;
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double x = VAR(julian2_a) * FTx + VAR(julian2_b) * FTy + VAR(julian2_e);
double y = VAR(julian2_c) * FTx + VAR(julian2_d) * FTy + VAR(julian2_f);
double sina = 0.0, cosa = 0.0;
double angle = (atan2(y, x) + M_2PI * (rand() % (int)VAR(absN)))/ VAR(julian2_power);
double r = VVAR * pow(sqr(x) + sqr(y), VAR(cN));
fsincos(angle, &sina, &cosa);
FPx += r * cosa;
FPy += r * sina;
return TRUE;
}

63
Plugin/juliaq.c Normal file
View File

@ -0,0 +1,63 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
int juliaq_power, juliaq_divisor;
double half_inv_power;
double inv_power, inv_power_2pi;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("juliaq");
// Define the Variables
APO_VARIABLES(
VAR_INTEGER_NONZERO(juliaq_power, 3),
VAR_INTEGER_NONZERO(juliaq_divisor, 2),
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(half_inv_power) = 0.5 * VAR(juliaq_divisor) / (double)VAR(juliaq_power);
VAR(inv_power) = VAR(juliaq_divisor) / (double)VAR(juliaq_power);
VAR(inv_power_2pi) = M_2PI / (double)VAR(juliaq_power);
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double sina, cosa;
fsincos( atan2(FTy, FTx)*VAR(inv_power) + rand()*VAR(inv_power_2pi),
&sina, &cosa);
double r = VVAR * pow(sqr(FTx) + sqr(FTy), VAR(half_inv_power));
FPx += r * cosa;
FPy += r * sina;
return TRUE;
}

81
Plugin/modulus.c Normal file
View File

@ -0,0 +1,81 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double modulus_x;
double modulus_y;
double xrange;
double yrange;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("modulus");
// Define the Variables
APO_VARIABLES(
VAR_REAL(modulus_x, 1.0),
VAR_REAL(modulus_y, 1.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(xrange) = 2.0 * VAR(modulus_x);
VAR(yrange) = 2.0 * VAR(modulus_y);
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
if (FTx > VAR(modulus_x))
{
FPx += VVAR * (-VAR(modulus_x) + fmod(FTx + VAR(modulus_x), VAR(xrange)));
}
else if (FTx < -VAR(modulus_x))
{
FPx += VVAR * (VAR(modulus_x) - fmod(VAR(modulus_x) - FTx, VAR(xrange)));
}
else
{
FPx += VVAR * FTx;
}
if (FTy > VAR(modulus_y))
{
FPy += VVAR * (-VAR(modulus_y) + fmod(FTy + VAR(modulus_y), VAR(yrange)));
}
else if (FTy < -VAR(modulus_y))
{
FPy += VVAR * (VAR(modulus_y) - fmod(VAR(modulus_y) - FTy, VAR(yrange)));
}
else
{
FPy += VVAR * FTy;
}
return TRUE;
}

71
Plugin/murl.c Normal file
View File

@ -0,0 +1,71 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double murl_c;
int murl_power;
double c, p2, vp;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("murl");
// Define the Variables
APO_VARIABLES(
VAR_REAL(murl_c, 0.0),
VAR_INTEGER_RANGE(murl_power, 2, 0x7fffffff, 2),
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
if (VAR(murl_power) != 1)
VAR(c) = VAR(murl_c) / (VAR(murl_power) - 1);
else
VAR(c) = VAR(murl_c);
VAR(p2) = VAR(murl_power) / 2.0;
VAR(vp) = VVAR * (VAR(c) + 1);
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double sina, cosa;
fsincos(atan2(FTy, FTx) * VAR(murl_power), &sina, &cosa);
double r = VAR(c) * pow(sqr(FTx) + sqr(FTy), VAR(p2));
double re = r * cosa + 1;
double im = r * sina;
double r1 = VAR(vp) / (sqr(re) + sqr(im));
FPx += r1 * (FTx*re + FTy*im);
FPy += r1 * (FTy*re - FTx*im);
return TRUE;
}

75
Plugin/murl2.c Normal file
View File

@ -0,0 +1,75 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double murl2_c;
int murl2_power;
double p2, invp, invp2, vp;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("murl2");
// Define the Variables
APO_VARIABLES(
VAR_REAL_RANGE(murl2_c, -1.0, 1.0, 0.0),
VAR_INTEGER_NONZERO(murl2_power, 1),
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(p2) = VAR(murl2_power) / 2.0;
VAR(invp) = 1.0 / VAR(murl2_power); // (2/p)/2
VAR(invp2) = 2.0 / VAR(murl2_power);
if (VAR(murl2_c) == -1) VAR(vp) = 0; else
VAR(vp) = VVAR * pow(VAR(murl2_c) + 1, 2.0 / VAR(murl2_power));
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double sina, cosa;
fsincos(atan2(FTy, FTx) * VAR(murl2_power), &sina, &cosa);
double r = VAR(murl2_c) * pow(sqr(FTx) + sqr(FTy), VAR(p2));
double re = r*cosa + 1;
double im = r*sina;
r = pow(sqr(re) + sqr(im), VAR(invp));
fsincos(atan2(im, re) * VAR(invp2), &sina, &cosa);
re = r * cosa;
im = r * sina;
double r1 = VAR(vp) / sqr(r); //(sqr(re) + sqr(im));
FPx += r1 * (FTx*re + FTy*im);
FPy += r1 * (FTy*re - FTx*im);
return TRUE;
}

65
Plugin/npolar.c Normal file
View File

@ -0,0 +1,65 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double npolar_vvar;
double npolar_vvar_2;
int npolar_n;
int npolar_nnz;
int npolar_parity;
int npolar_isodd;
double npolar_cn;
double npolar_absn;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
APO_PLUGIN("npolar");
APO_VARIABLES(
VAR_INTEGER(npolar_parity, 0),
VAR_INTEGER(npolar_n, 1)
);
int PluginVarPrepare(Variation* vp)
{
VAR(npolar_nnz) = (VAR(npolar_n) == 0) ? 1 : VAR(npolar_n);
VAR(npolar_vvar) = VVAR / M_PI;
VAR(npolar_vvar_2) = VAR(npolar_vvar) * 0.5;
VAR(npolar_absn) = abs(VAR(npolar_nnz));
VAR(npolar_cn) = 1.0 / VAR(npolar_nnz) / 2;
VAR(npolar_isodd) = abs(VAR(npolar_parity)) % 2;
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double sina = 0.0, cosa = 0.0;
double x = (VAR(npolar_isodd) != 0) ? FTx : VAR(npolar_vvar) * atan2(FTx, FTy);
double y = (VAR(npolar_isodd) != 0) ? FTy : VAR(npolar_vvar_2) * log(FTx*FTx + FTy*FTy);
double angle = (atan2(y, x) + M_2PI * (rand() % (int)VAR(npolar_absn)))/ VAR(npolar_nnz);
double r = VVAR * pow(sqr(x) + sqr(y), VAR(npolar_cn)) * ((VAR(npolar_isodd) == 0) ? 1.0 : VAR(npolar_parity));
fsincos(angle, &sina, &cosa); cosa *= r; sina *= r;
x = (VAR(npolar_isodd) != 0) ? cosa : (VAR(npolar_vvar_2) * log(cosa*cosa + sina*sina));
y = (VAR(npolar_isodd) != 0) ? sina : (VAR(npolar_vvar) * atan2(cosa, sina));
FPx += x; FPy += y;
return TRUE;
}

147
Plugin/octapol.c Normal file
View File

@ -0,0 +1,147 @@
/*
Octapol plugin for Apophysis
Written by Georg K. (http://xyrus02.deviantart.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double x;
double y;
} double2;
#define DOUBLE2(x,y) { x, y }
#define DENOM_SQRT2 0.707106781
typedef struct
{
double rad, s, t, a;
double ax, ay, bx, by, cx, cy,
dx, dy, ex, ey, fx, fy,
gx, gy, hx, hy, ix, iy,
jx, jy, kx, ky, lx, ly;
double octapol_polarweight;
double octapol_radius;
double octapol_s;
double octapol_t;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("octapol");
APO_VARIABLES(
VAR_REAL(octapol_polarweight, 0.0),
VAR_REAL(octapol_radius, 1.0),
VAR_REAL(octapol_s, 0.5),
VAR_REAL(octapol_t, 0.5)
);
int PluginVarPrepare(Variation* vp)
{
VAR(s) = fabs(VAR(octapol_s));
VAR(t) = fabs(VAR(octapol_t));
VAR(a) = VAR(s) * 0.5 + VAR(t);
VAR(rad) = DENOM_SQRT2 * VAR(s) * fabs(VAR(octapol_radius));
VAR(ax) = -0.5 * VAR(s); VAR(ay) = 0.5 * VAR(s) + VAR(t);
VAR(bx) = 0.5 * VAR(s); VAR(by) = 0.5 * VAR(s) + VAR(t);
VAR(cx) = VAR(t); VAR(cy) = 0.5 * VAR(s);
VAR(dx) = VAR(t); VAR(dy) = -0.5 * VAR(s);
VAR(ex) = 0.5 * VAR(s); VAR(ey) = -0.5 * VAR(s) - VAR(t);
VAR(fx) = -0.5 * VAR(s); VAR(fy) = -0.5 * VAR(s) - VAR(t);
VAR(gx) = -VAR(t); VAR(gy) = -0.5 * VAR(s);
VAR(hx) = -VAR(t); VAR(hy) = 0.5 * VAR(s);
VAR(ix) = -0.5 * VAR(s); VAR(iy) = 0.5 * VAR(s);
VAR(jx) = 0.5 * VAR(s); VAR(jy) = 0.5 * VAR(s);
VAR(kx) = -0.5 * VAR(s); VAR(ky) = -0.5 * VAR(s);
VAR(lx) = 0.5 * VAR(s); VAR(ly) = -0.5 * VAR(s);
return TRUE;
}
inline double dot(double2 a, double2 b) {
return a.x * b.x + a.y * b.y;
}
inline double lerp(double a, double b, double p) {
return a + p * (b - a);
}
inline int hits_rect(double2 tl, double2 br, double2 p) {
return (p.x >= tl.x && p.y >= tl.y && p.x <= br.x && p.y <= br.y);
}
inline int hits_triangle(double2 a, double2 b, double2 c, double2 p, double* u, double* v) {
double2 v0 = DOUBLE2(c.x - a.x, c.y - a.y);
double2 v1 = DOUBLE2(b.x - a.x, b.y - a.y);
double2 v2 = DOUBLE2(p.x - a.x, p.y - a.y);
double d00 = dot(v0, v0);
double d01 = dot(v0, v1);
double d02 = dot(v0, v2);
double d11 = dot(v1, v1);
double d12 = dot(v1, v2);
double denom = (d00 * d11 - d01 * d01);
if (denom != 0) {
*u = (d11 * d02 - d01 * d12) / denom;
*v = (d00 * d12 - d01 * d02) / denom;
} else {
*u = *v = 0;
}
return ((*u + *v) < 1.0) && (*u > 0) && (*v > 0);
}
inline int hits_square_around_origin(double a, double2 p) {
return (fabs(p.x) <= a && fabs(p.y) <= a);
}
inline int hits_circle_around_origin(double radius, double2 p, double* r) {
if (radius == 0.0) return TRUE;
*r = sqrt(sqr(p.x) + sqr(p.y));
return (*r <= radius);
}
int PluginVarCalc(Variation* vp)
{
double x = FTx * 0.15, y = FTy * 0.15, z = FTz, r = 0, u = 0, v = 0, x2 = 0, y2 = 0;
double2 XY = DOUBLE2(x, y);
double2 A = DOUBLE2(VAR(ax), VAR(ay)), B = DOUBLE2(VAR(bx), VAR(by)), C = DOUBLE2(VAR(cx), VAR(cy)),
D = DOUBLE2(VAR(dx), VAR(dy)), E = DOUBLE2(VAR(ex), VAR(ey)), F = DOUBLE2(VAR(fx), VAR(fy)),
G = DOUBLE2(VAR(gx), VAR(gy)), H = DOUBLE2(VAR(hx), VAR(hy)), I = DOUBLE2(VAR(ix), VAR(iy)),
J = DOUBLE2(VAR(jx), VAR(jy)), K = DOUBLE2(VAR(kx), VAR(ky)), L = DOUBLE2(VAR(lx), VAR(ly));
if ((VAR(rad) > 0) && hits_circle_around_origin(VAR(rad), XY, &r)) {
double rd = log(sqr(r / VAR(rad)));
double phi = atan2(y, x);
FPx += VVAR * lerp(x, phi, rd * VAR(octapol_polarweight));
FPy += VVAR * lerp(y, r, rd * VAR(octapol_polarweight));
} else if (hits_square_around_origin(VAR(a), XY)) {
if (hits_rect(H, K, XY) || hits_rect(J, D, XY) ||
hits_rect(A, J, XY) || hits_rect(K, E, XY) ||
hits_triangle(I, A, H, XY, &u, &v) ||
hits_triangle(J, B, C, XY, &u, &v) ||
hits_triangle(L, D, E, XY, &u, &v) ||
hits_triangle(K, F, G, XY, &u, &v)) {
FPx += VVAR * x; FPy += VVAR * y;
} else FPx = FPy = 0;
} else FPx = FPy = 0;
FPx += VVAR * x;
FPy += VVAR * y;
FPz += VVAR * z;
return TRUE;
}

131
Plugin/ortho.c Normal file
View File

@ -0,0 +1,131 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double ortho_in;
double ortho_out;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("ortho");
// Define the Variables
APO_VARIABLES(
VAR_REAL_CYCLE(ortho_in, -M_PI, M_PI, 0.0),
VAR_REAL_CYCLE(ortho_out, -M_PI, M_PI, 0.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double r, a;
double xo;
double ro;
double c,s;
double x,y, tc, ts;
double theta;
r = sqr(FTx) + sqr(FTy);
if ( r < 1.0)// && FTx > 0.0 && FTy > 0.0)
{
if(FTx >= 0.0)
{
xo = (r + 1.0)/ (2.0 * FTx);
ro = sqrt(sqr(FTx - xo) + sqr(FTy));
theta = atan2(1.0 , ro);
a = fmod( VAR(ortho_in)* theta + atan2(FTy, xo - FTx ) + theta, 2.0 * theta) - theta;
fsincos(a, &s, &c);
FPx += VVAR * (xo - c * ro);
FPy += VVAR * s * ro;
}
else
{
xo = - (r + 1.0)/ (2.0 * FTx);
ro = sqrt(sqr(-FTx - xo) + sqr(FTy));
theta = atan2(1.0 , ro);
a = fmod( VAR(ortho_in) * theta + atan2(FTy, xo + FTx ) + theta, 2.0 * theta) - theta;
fsincos(a, &s, &c);
FPx -= VVAR * (xo - c * ro);
FPy += VVAR * s * ro;
}
}
else
{
r = 1.0 / sqrt(r);
fsincos( atan2(FTy, FTx), &ts, &tc);
x = r * tc;
y = r * ts;
if(x >= 0.0)
{
xo = (sqr(x) + sqr(y) + 1.0)/ (2.0 * x);
ro = sqrt(sqr(x - xo) + sqr(y));
theta = atan2(1.0 , ro);
a = fmod( VAR(ortho_out)* theta + atan2(y, xo - x ) + theta, 2.0 * theta) - theta;
fsincos(a, &s, &c);
x = (xo - c * ro);
y = s * ro;
fsincos( atan2(y, x), &ts, &tc);
r = 1.0 / sqrt(sqr(x) + sqr(y));
FPx += VVAR * r * tc;
FPy += VVAR * r * ts;
}
else
{
xo = - (sqr(x) + sqr(y) + 1.0)/ (2.0 * x);
ro = sqrt(sqr(-x - xo) + sqr(y));
theta = atan2(1.0 , ro);
a = fmod( VAR(ortho_out) * theta + atan2(y, xo + x ) + theta, 2.0 * theta) - theta;
fsincos(a, &s, &c);
x = (xo - c * ro);
y = s * ro;
fsincos( atan2(y, x), &ts, &tc);
r = 1.0 / sqrt(sqr(x) + sqr(y));
FPx -= VVAR * r * tc;
FPy += VVAR * r * ts;
}
}
return TRUE;
}

78
Plugin/oscilloscope.c Normal file
View File

@ -0,0 +1,78 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double oscope_separation;
double oscope_frequency;
double oscope_amplitude;
double oscope_damping;
double TWO_PI_freq;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("oscilloscope");
// Define the Variables
APO_VARIABLES(
VAR_REAL(oscope_separation, 1.0),
VAR_REAL(oscope_frequency, M_PI),
VAR_REAL(oscope_amplitude, 1.0),
VAR_REAL(oscope_damping, 0.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(TWO_PI_freq) = VAR(oscope_frequency) * M_PI*2;
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double t;
if(VAR(oscope_damping) == 0)
{
t = VAR(oscope_amplitude)*cos(VAR(TWO_PI_freq)*FTx) + VAR(oscope_separation);
}
else
{
t = VAR(oscope_amplitude)*exp(-fabs(FTx)*VAR(oscope_damping))*cos(VAR(TWO_PI_freq)*FTx) + VAR(oscope_separation);
}
if(fabs(FTy) <= t)
{
FPx += VVAR*FTx;
FPy -= VVAR*FTy;
}
else
{
FPx += VVAR*FTx;
FPy += VVAR*FTy;
}
return TRUE;
}

74
Plugin/pie.c Normal file
View File

@ -0,0 +1,74 @@
/*
Apophysis Plugin
Copyright (C) 2007-2008 Joel Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
int pie_slices;
double pie_thickness;
double pie_rotation;
double pi2_slices;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("pie");
// Define the Variables
APO_VARIABLES(
VAR_INTEGER_NONZERO(pie_slices, 6),
VAR_REAL_RANGE(pie_thickness, 0.0, 1.0, 0.5),
VAR_REAL_CYCLE(pie_rotation, 0.0, 2.0 * M_PI, 0.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(pi2_slices) = 2 * M_PI / VAR(pie_slices);
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
int sl;
double a, r;
double s, c;
sl = rand() % VAR(pie_slices); // Pick a random slice.
// Choose a random angle in the slice.
a = VAR(pie_rotation) + VAR(pi2_slices) * (sl + VAR(pie_thickness) * random01());
// Choose a random distance from the centre, scaled by VVAR.
r = VVAR * random01();
// Convert from polar coordinates to rectangular coordinates.
fsincos(a, &s, &c);
FPx += r * c;
FPy += r * s;
return TRUE;
}

79
Plugin/poincare.c Normal file
View File

@ -0,0 +1,79 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double c1x;
double c1y;
double c2x;
double c2y;
double poincare_c1r;
double poincare_c2r;
double c1d; //r0 + r1
double c2d; //r0 + r2
double poincare_c1a;
double poincare_c2a;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("poincare");
// Define the Variables
APO_VARIABLES(
VAR_REAL(poincare_c1r, 1.0),
VAR_REAL_CYCLE(poincare_c1a, -M_PI, M_PI, -1.0),
VAR_REAL(poincare_c2r, 1.0),
VAR_REAL_CYCLE(poincare_c2a, -M_PI, M_PI, 1.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(c1d) = sqrt( 1.0 + sqr(VAR(poincare_c1r)) );
VAR(c2d) = sqrt( 1.0 + sqr(VAR(poincare_c2r)) );
VAR(c1x) = VAR(c1d) * cos ( VAR(poincare_c1a));
VAR(c1y) = VAR(c1d) * sin ( VAR(poincare_c1a));
VAR(c2x) = VAR(c2d) * cos ( VAR(poincare_c2a));
VAR(c2y) = VAR(c2d) * sin ( VAR(poincare_c2a));
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double x, y;
x = VAR(c1x) + ( sqr(VAR(poincare_c1r)) * ( FTx - VAR(c1x))) / ( sqr(FTx - VAR(c1x)) + sqr(FTy - VAR(c1y)) );
y = VAR(c1y) + ( sqr(VAR(poincare_c1r)) * ( FTy - VAR(c1y))) / ( sqr(FTx - VAR(c1x)) + sqr(FTy - VAR(c1y)) );
FPx += VAR(c2x) + ( sqr(VAR(poincare_c2r)) * ( x - VAR(c2x))) / ( sqr(x - VAR(c2x)) + sqr(y - VAR(c2y)) );
FPy += VAR(c2y) + ( sqr(VAR(poincare_c2r)) * ( y - VAR(c2y))) / ( sqr(x - VAR(c2x)) + sqr(y - VAR(c2y)) );
return TRUE;
}

88
Plugin/poincare3D.c Normal file
View File

@ -0,0 +1,88 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double poincare3D_r, poincare3D_a, poincare3D_b;
double cx, cy, cz;
double c2;
double c2x, c2y, c2z;
double s2x, s2y, s2z;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("poincare3D");
// Define the Variables
APO_VARIABLES(
VAR_REAL(poincare3D_r, 0.0),
VAR_REAL(poincare3D_a, 0.0),
VAR_REAL(poincare3D_b, 0.0),
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(cx) = -VAR(poincare3D_r) * cos(VAR(poincare3D_a)*M_PI_2) * cos(VAR(poincare3D_b)*M_PI_2);
VAR(cy) = VAR(poincare3D_r) * sin(VAR(poincare3D_a)*M_PI_2) * cos(VAR(poincare3D_b)*M_PI_2);
VAR(cz) = -VAR(poincare3D_r) * sin(VAR(poincare3D_b)*M_PI_2);
VAR(c2) = sqr(VAR(cx)) + sqr(VAR(cy)) + sqr(VAR(cz));
VAR(c2x) = 2 * VAR(cx);
VAR(c2y) = 2 * VAR(cy);
VAR(c2z) = 2 * VAR(cz);
VAR(s2x) = sqr(VAR(cx)) - sqr(VAR(cy)) - sqr(VAR(cz)) + 1;
VAR(s2y) = sqr(VAR(cy)) - sqr(VAR(cx)) - sqr(VAR(cz)) + 1;
VAR(s2z) = sqr(VAR(cz)) - sqr(VAR(cy)) - sqr(VAR(cx)) + 1;
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double r2 = sqr(FTx) + sqr(FTy) + sqr(FTz);
double x2cx = VAR(c2x)*FTx, y2cy = VAR(c2y)*FTy, z2cz = VAR(c2z)*FTz;
double d = VVAR / (
VAR(c2) * r2 - x2cx - y2cy - z2cz + 1
);
FPx += d * (
FTx * VAR(s2x) + VAR(cx) * (y2cy + z2cz - r2 - 1)
);
FPy += d * (
FTy * VAR(s2y) + VAR(cy) * (x2cx + z2cz - r2 - 1)
);
FPz += d * (
FTz * VAR(s2z) + VAR(cz) * (y2cy + x2cx - r2 - 1)
);
return TRUE;
}

56
Plugin/polynomial.c Normal file
View File

@ -0,0 +1,56 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double polynomial_powx, polynomial_powy;
double polynomial_lcx, polynomial_lcy;
double polynomial_scx, polynomial_scy;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("polynomial");
APO_VARIABLES(
VAR_REAL(polynomial_powx, 1.0),
VAR_REAL(polynomial_powy, 1.0),
VAR_REAL(polynomial_lcx, 0.0),
VAR_REAL(polynomial_lcy, 0.0),
VAR_REAL(polynomial_scx, 0.0),
VAR_REAL(polynomial_scy, 0.0)
);
int PluginVarPrepare(Variation* vp)
{
return TRUE;
}
inline double sgn(double v) { return (v < 0) ? -1 : (v > 0) ? 1 : 0; }
int PluginVarCalc(Variation* vp)
{
double xp = pow(VVAR * fabs(FTx), VAR(polynomial_powx));
double yp = pow(VVAR * fabs(FTy), VAR(polynomial_powy));
double zp = VVAR * FTz;
FPx += xp * sgn(FTx) + VAR(polynomial_lcx) * FTx + VAR(polynomial_scx);
FPy += yp * sgn(FTy) + VAR(polynomial_lcy) * FTy + VAR(polynomial_scy);
FPz += zp;
return TRUE;
}

55
Plugin/popcorn2.c Normal file
View File

@ -0,0 +1,55 @@
/*
Apophysis Plugin
Copyright (C) 2007 Gygrazok
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double popcorn2_x;
double popcorn2_y;
double popcorn2_c;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("popcorn2");
// Define the Variables
APO_VARIABLES(
VAR_REAL(popcorn2_x, 0.1),
VAR_REAL(popcorn2_y, 0.1),
VAR_REAL(popcorn2_c, 3.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
FPx += VVAR * (FTx + VAR(popcorn2_x) * sin(tan(VAR(popcorn2_c)*FTy)));
FPy += VVAR * (FTy + VAR(popcorn2_y) * sin(tan(VAR(popcorn2_c)*FTx)));
return TRUE;
}

69
Plugin/post_dcztransl.c Normal file
View File

@ -0,0 +1,69 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Written by Georg Kiehne
--> http://xyrus-worx.net, http://xyrus02.deviantart.com
If you find any bugs / nags - keep them :)
*/
typedef struct {
double post_dcztransl_x0;
double post_dcztransl_x1;
double post_dcztransl_factor;
double x0_, x1_, x1_m_x0;
int post_dcztransl_overwrite;
int post_dcztransl_clamp;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("post_dcztransl");
APO_VARIABLES(
VAR_REAL_RANGE(post_dcztransl_x0, 0.0, 1.0, 0.0),
VAR_REAL_RANGE(post_dcztransl_x1, 0.0, 1.0, 1.0),
VAR_REAL(post_dcztransl_factor, 1.0),
VAR_INTEGER_RANGE(post_dcztransl_overwrite, 0, 1, 1),
VAR_INTEGER_RANGE(post_dcztransl_clamp, 0, 1, 0)
);
int PluginVarPrepare(Variation* vp)
{
vp->var.x0_ = vp->var.post_dcztransl_x0 < vp->var.post_dcztransl_x1 ? vp->var.post_dcztransl_x0 : vp->var.post_dcztransl_x1;
vp->var.x1_ = vp->var.post_dcztransl_x0 > vp->var.post_dcztransl_x1 ? vp->var.post_dcztransl_x0 : vp->var.post_dcztransl_x1;
vp->var.x1_m_x0 = vp->var.x1_ - vp->var.x0_ == 0 ? EPS : vp->var.x1_ - vp->var.x0_;
return 1;
}
inline double flip(double a, double b, double c){return (c*(b-a)+a);}
int PluginVarCalc(Variation* vp)
{
double zf = vp->var.post_dcztransl_factor * (*(vp->pColor) - vp->var.x0_) / vp->var.x1_m_x0;
if (vp->var.post_dcztransl_clamp != 0)
zf = zf < 0 ? 0 : zf > 1 ? 1 : zf;
*(vp->pFPx) = vp->vvar*(*(vp->pFPx));
*(vp->pFPy) = vp->vvar*(*(vp->pFPy));
if (vp->var.post_dcztransl_overwrite == 0)
*(vp->pFPz) = vp->vvar*(*(vp->pFPz))*zf;
else *(vp->pFPz) = vp->vvar*zf;
return 1;
}

34
Plugin/post_mirror_x.c Normal file
View File

@ -0,0 +1,34 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define APO_NOVARIABLES
#include "apoplugin.h"
APO_PLUGIN("post_mirror_x");
int PluginVarPrepare(Variation* vp)
{
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
FPx = fabs(FPx);
if (rand() & 1) FPx = -FPx;
return TRUE;
}

34
Plugin/post_mirror_y.c Normal file
View File

@ -0,0 +1,34 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define APO_NOVARIABLES
#include "apoplugin.h"
APO_PLUGIN("post_mirror_y");
int PluginVarPrepare(Variation* vp)
{
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
FPy = fabs(FPy);
if (rand() & 1) FPy = -FPy;
return TRUE;
}

34
Plugin/post_mirror_z.c Normal file
View File

@ -0,0 +1,34 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define APO_NOVARIABLES
#include "apoplugin.h"
APO_PLUGIN("post_mirror_z");
int PluginVarPrepare(Variation* vp)
{
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
FPz = fabs(FPz);
if (rand() & 1) FPz = -FPz;
return TRUE;
}

50
Plugin/post_polar2.c Normal file
View File

@ -0,0 +1,50 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double post_polar2_vvar;
double post_polar2_vvar_2;
} Variables;
#define M_PI 3.14159265358979323846
#define APO_NOVARIABLES
#define APO_VIRTUALVAR
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("post_polar2");
int PluginVarPrepare(Variation* vp)
{
VAR(post_polar2_vvar) = VVAR / M_PI;
VAR(post_polar2_vvar_2) = VAR(post_polar2_vvar) * 0.5;
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
FPy = VAR(post_polar2_vvar_2) * log(FPx*FPx + FPy*FPy);
FPx = VAR(post_polar2_vvar) * atan2(FPx, FPy);
return TRUE;
}

51
Plugin/post_rblur.c Normal file
View File

@ -0,0 +1,51 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct {
double post_rblur_strength;
double post_rblur_offset;
double post_rblur_center_x;
double post_rblur_center_y;
double s2;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("post_rblur");
APO_VARIABLES(
VAR_REAL(post_rblur_strength, 1.0),
VAR_REAL(post_rblur_offset, 1.0),
VAR_REAL(post_rblur_center_x, 0.0),
VAR_REAL(post_rblur_center_y, 0.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(s2) = 2.0 * VAR(post_rblur_strength);
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double r = sqrt(sqr(FPx - VAR(post_rblur_center_x)) + sqr(FPy - VAR(post_rblur_center_y))) - VAR(post_rblur_offset);
r = r<0?0:r; r *= VAR(s2);
FPx = VVAR * (FPx + (random01() - 0.5) * r);
FPy = VVAR * (FPy + (random01() - 0.5) * r);
return TRUE;
}

105
Plugin/pre_boarders2.c Normal file
View File

@ -0,0 +1,105 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double pre_boarders2_c;
double pre_boarders2_left;
double pre_boarders2_right;
double c, cl, cr;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
inline double rint(double x)
{
int temp; temp = (x >= 0. ? (int)(x + 0.5) : (int)(x - 0.5));
return (double)temp;
}
APO_PLUGIN("pre_boarders2");
APO_VARIABLES(
VAR_REAL(pre_boarders2_c, 0.5),
VAR_REAL(pre_boarders2_left, 0.5),
VAR_REAL(pre_boarders2_right, 0.5),
);
int PluginVarPrepare(Variation* vp)
{
double c = fabs(VAR(pre_boarders2_c)),
cl = fabs(VAR(pre_boarders2_left)),
cr = fabs(VAR(pre_boarders2_right));
c = c==0?EPS:c; cl = cl==0?EPS:cl; cr = cr==0?EPS:cr;
VAR(c) = c; VAR(cl) = c*cl; VAR(cr) = c+(c*cr);
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
const double c = vp->var.c;
const double cl = vp->var.cl;
const double cr = vp->var.cr;
double roundX, roundY, offsetX, offsetY;
roundX = rint(FTx);
roundY = rint(FTy);
offsetX = FTx - roundX;
offsetY = FTy - roundY;
if(random01() >= cr)
{
FTx = VVAR*(offsetX*c + roundX);
FTy = VVAR*(offsetY*c + roundY);
}
else
{
if(fabs(offsetX) >= fabs(offsetY))
{
if(offsetX >= 0.0)
{
FTx = VVAR*(offsetX*c + roundX + cl);
FTy = VVAR*(offsetY*c + roundY + cl * offsetY / offsetX);
}
else
{
FTx = VVAR*(offsetX*c + roundX - cl);
FTy = VVAR*(offsetY*c + roundY - cl * offsetY / offsetX);
}
}
else
{
if(offsetY >= 0.0)
{
FTy = VVAR*(offsetY*c + roundY + cl);
FTx = VVAR*(offsetX*c + roundX + offsetX/offsetY*cl);
}
else
{
FTy = VVAR*(offsetY*c + roundY - cl);
FTx = VVAR*(offsetX*c + roundX - offsetX/offsetY*cl);
}
}
}
return TRUE;
}

68
Plugin/pre_dcztransl.c Normal file
View File

@ -0,0 +1,68 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Written by Georg Kiehne
--> http://xyrus-worx.net, http://xyrus02.deviantart.com
If you find any bugs / nags - keep them :)
*/
typedef struct {
double pre_dcztransl_x0;
double pre_dcztransl_x1;
double pre_dcztransl_factor;
double x0_, x1_, x1_m_x0;
int pre_dcztransl_overwrite;
int pre_ztransl_clamp;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("pre_dcztransl");
APO_VARIABLES(
VAR_REAL_RANGE(pre_dcztransl_x0, 0.0, 1.0, 0.0),
VAR_REAL_RANGE(pre_dcztransl_x1, 0.0, 1.0, 1.0),
VAR_REAL(pre_dcztransl_factor, 1.0),
VAR_INTEGER_RANGE(pre_dcztransl_overwrite, 0, 1, 1),
VAR_INTEGER_RANGE(pre_ztransl_clamp, 0, 1, 0)
);
int PluginVarPrepare(Variation* vp)
{
vp->var.x0_ = vp->var.pre_dcztransl_x0 < vp->var.pre_dcztransl_x1 ? vp->var.pre_dcztransl_x0 : vp->var.pre_dcztransl_x1;
vp->var.x1_ = vp->var.pre_dcztransl_x0 > vp->var.pre_dcztransl_x1 ? vp->var.pre_dcztransl_x0 : vp->var.pre_dcztransl_x1;
vp->var.x1_m_x0 = vp->var.x1_ - vp->var.x0_ == 0 ? EPS : vp->var.x1_ - vp->var.x0_;
return 1;
}
inline double flip(double a, double b, double c){return (c*(b-a)+a);}
int PluginVarCalc(Variation* vp)
{
double zf = vp->var.pre_dcztransl_factor * (*(vp->pColor) - vp->var.x0_) / vp->var.x1_m_x0;
if (vp->var.pre_ztransl_clamp != 0)
zf = zf < 0 ? 0 : zf > 1 ? 1 : zf;
*(vp->pFTx) = vp->vvar*(*(vp->pFTx));
*(vp->pFTy) = vp->vvar*(*(vp->pFTy));
if (vp->var.pre_dcztransl_overwrite == 0)
*(vp->pFTz) = vp->vvar*(*(vp->pFTz))*zf;
else *(vp->pFTz) = vp->vvar*zf;
return 1;
}

59
Plugin/psphere.c Normal file
View File

@ -0,0 +1,59 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double vvar_pi;
double psphere_zscale;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
APO_PLUGIN("psphere");
APO_VARIABLES(
VAR_REAL(psphere_zscale, 0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(vvar_pi) = VVAR * M_PI;
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double c0 = FTx * VAR(vvar_pi);
double c1 = FTy * VAR(vvar_pi);
double c2 = FTz * VAR(vvar_pi);
double sinc0, cosc0, sinc1, cosc1;
fsincos(c0, &sinc0, &cosc0);
fsincos(c1, &sinc1, &cosc1);
double x = cosc0 * -sinc1;
double y = sinc0 * cosc1;
double z = cosc1 * VAR(psphere_zscale);
FPx += x;
FPy += y;
FPz += z;
return TRUE;
}

113
Plugin/rational3.c Normal file
View File

@ -0,0 +1,113 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double rational3_vvar;
double rational3_t3;
double rational3_t2;
double rational3_t1;
double rational3_tc;
double rational3_b3;
double rational3_b2;
double rational3_b1;
double rational3_bc;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("rational3");
// Define the Variables
APO_VARIABLES(
VAR_REAL(rational3_t3, 1.0),
VAR_REAL(rational3_t2, 0.0),
VAR_REAL(rational3_t1, 0.0),
VAR_REAL(rational3_tc, 1.0),
VAR_REAL(rational3_b3, 0.0),
VAR_REAL(rational3_b2, 1.0),
VAR_REAL(rational3_b1, 0.0),
VAR_REAL(rational3_bc, 1.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(rational3_vvar) = VVAR;
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double xsqr = FTx * FTx;
double ysqr = FTy * FTy;
double xcb = FTx * FTx * FTx;
double ycb = FTy * FTy * FTy;
double tr = VAR(rational3_t3) * (xcb - 3 * FTx * ysqr) + VAR(rational3_t2) * (xsqr - ysqr) + VAR(rational3_t1) * FTx + VAR(rational3_tc);
double ti = VAR(rational3_t3) * (3 * xsqr * FTy - ycb) + VAR(rational3_t2) * 2 * FTx * FTy + VAR(rational3_t1) * FTy;
double br = VAR(rational3_b3) * (xcb - 3 * FTx * ysqr) + VAR(rational3_b2) * (xsqr - ysqr) + VAR(rational3_b1) * FTx + VAR(rational3_bc);
double bi = VAR(rational3_b3) * (3 * xsqr * FTy - ycb) + VAR(rational3_b2) * 2 * FTx * FTy + VAR(rational3_b1) * FTy;
double r3den = 1/(br * br + bi * bi);
FPx += VAR(rational3_vvar) * (tr * br + ti * bi) * r3den;
FPy += VAR(rational3_vvar) * (ti * br - tr * bi) * r3den;
// FPx += VAR(rational3_vvar) * FTx * 2;
// FPy += VAR(rational3_vvar) * FTy * 2;
return TRUE;
}
// Rational3 allows you to customize a rational function
// involving the complex variable z. It can be represented
// as the function...
// az^3 + bz^2 + cz + d
// -------------------- division line
// ez^3 + fz^2 + gz + h
// In this case,
// t3 = a (top z^3 coefficient)
// t2 = b
// t1 = c
// tc = d (top constant)
// b3 = e (bottom z^3 coefficient)
// b2 = f
// b1 = g
// bc = h (bottom constant)
// This baby was a beast to work out, so please don't ask
// me to explain the whole thing.
// This works sort of like Curl, except Curl uses the formula...
// z
// -------------
// bz^2 + az + 1
// Which is weird and abstract (one might say pointless,
// but that would be mean).

101
Plugin/ripple.c Normal file
View File

@ -0,0 +1,101 @@
typedef struct
{
// variables
double ripple_frequency,
ripple_velocity,
ripple_amplitude,
ripple_centerx,
ripple_centery,
ripple_phase,
ripple_scale;
// private stuff
double f, a, p, s, is,
vxp, pxa, pixa;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
APO_PLUGIN("ripple");
APO_VARIABLES(
// wave function frequency
VAR_REAL(ripple_frequency, 2.0),
// wave velocity
VAR_REAL(ripple_velocity, 1.0),
// wave amplitude
VAR_REAL(ripple_amplitude, 0.5),
// origin of the ripple (x,y)
VAR_REAL(ripple_centerx, 0.0),
VAR_REAL(ripple_centery, 0.0),
// wave phase / interpolation coefficient
VAR_REAL(ripple_phase, 0.0),
// ripple scale
VAR_REAL(ripple_scale, 1.0)
);
int PluginVarPrepare(Variation* vp)
{
// some variables are settled in another range for edit comfort
// - transform them
VAR(f) = VAR(ripple_frequency) * 5;
VAR(a) = VAR(ripple_amplitude) * 0.01;
VAR(p) = VAR(ripple_phase) * M_2PI - M_PI;
// scale must not be zero
VAR(s) = VAR(ripple_scale) == 0 ? EPS : VAR(ripple_scale);
// we will need the inverse scale
VAR(is) = 1 / VAR(s);
// pre-multiply velocity+phase, phase+amplitude and (PI-phase)+amplitude
VAR(vxp) = VAR(ripple_velocity) * VAR(p);
VAR(pxa) = VAR(p) * VAR(a);
VAR(pixa) = (M_PI - VAR(p)) * VAR(a);
// done
return TRUE;
}
inline double lerp(double a, double b, double p) { return a + (b - a) * p; }
int PluginVarCalc(Variation* vp)
{
//align input x, y to given center and multiply with scale
double x = (FTx * VAR(s)) - VAR(ripple_centerx),
y = (FTy * VAR(s)) + VAR(ripple_centery);
// calculate distance from center but constrain it to EPS
double d = MAX(EPS, sqrt(sqr(x) * sqr(y)));
// normalize (x,y)
double nx = x / d,
ny = y / d;
// calculate cosine wave with given frequency, velocity
// and phase based on the distance to center
double wave = cos(VAR(f) * d - VAR(vxp));
// calculate the wave offsets
double d1 = wave * VAR(pxa) + d,
d2 = wave * VAR(pixa) + d;
// we got two offsets, so we also got two new positions (u,v)
double u1 = (VAR(ripple_centerx) + nx * d1),
v1 = (-VAR(ripple_centery) + ny * d1);
double u2 = (VAR(ripple_centerx) + nx * d2),
v2 = (-VAR(ripple_centery) + ny * d2);
// interpolate the two positions by the given phase and
// invert the multiplication with scale from before
FPx = VVAR * (lerp(u1, u2, VAR(p))) * VAR(is);
FPy = VVAR * (lerp(v1, v2, VAR(p))) * VAR(is);
// done
return TRUE;
}

74
Plugin/sigmoid.c Normal file
View File

@ -0,0 +1,74 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double sigmoid_shiftx;
double sigmoid_shifty;
double sx, sy, ax, ay, vv;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("sigmoid");
APO_VARIABLES(
VAR_REAL(sigmoid_shiftx, 1.0),
VAR_REAL(sigmoid_shifty, 1.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(ax) = 1.0; VAR(ay) = 1.0;
VAR(sx) = VAR(sigmoid_shiftx); VAR(sy) = VAR(sigmoid_shifty);
if (VAR(sx) < 1 && VAR(sx) > -1) {
if (VAR(sx) == 0) {
VAR(sx) = EPS; VAR(ax) = 1.0;
} else {
VAR(ax) = (VAR(sx) < 0 ? -1 : 1);
VAR(sx) = 1 / VAR(sx);
}
}
if (VAR(sy) < 1 && VAR(sy) > -1) {
if (VAR(sy) == 0) {
VAR(sy) = EPS; VAR(ay) = 1.0;
} else {
VAR(ay) = (VAR(sy) < 0 ? -1 : 1);
VAR(sy) = 1 / VAR(sy);
}
}
VAR(sx) *= -5;
VAR(sy) *= -5;
VAR(vv) = fabs(VVAR);
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double c0 = VAR(ax) / (1.0 + exp(VAR(sx) * FTx));
double c1 = VAR(ay) / (1.0 + exp(VAR(sy) * FTy));
double x = (2 * (c0 - 0.5));
double y = (2 * (c1 - 0.5));
FPx += VAR(vv) * x;
FPy += VAR(vv) * y;
return TRUE;
}

66
Plugin/sinusgrid.c Normal file
View File

@ -0,0 +1,66 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double sinusgrid_ampx;
double sinusgrid_ampy;
double sinusgrid_freqx;
double sinusgrid_freqy;
double fx, fy, ax, ay;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("sinusgrid");
APO_VARIABLES(
//VAR_REAL_CYCLE(sinusgrid_ampx, 0.0, 1.0, 0.5),
//VAR_REAL_CYCLE(sinusgrid_ampy, 0.0, 1.0, 0.5),
VAR_REAL(sinusgrid_ampx, 0.5),
VAR_REAL(sinusgrid_ampy, 0.5),
VAR_REAL(sinusgrid_freqx, 1.0),
VAR_REAL(sinusgrid_freqy, 1.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(ax) = VAR(sinusgrid_ampx);
VAR(ay) = VAR(sinusgrid_ampy);
VAR(fx) = VAR(sinusgrid_freqx) * M_2PI;
VAR(fy) = VAR(sinusgrid_freqy) * M_2PI;
if (VAR(fx) == 0.0) VAR(fx) = EPS;
if (VAR(fy) == 0.0) VAR(fy) = EPS;
return TRUE;
}
inline double lerp(double a, double b, double p) { return a + p * (b-a); }
int PluginVarCalc(Variation* vp)
{
double x = FTx, y = FTy;
double sx = -1.0 * cos(x * VAR(fx));
double sy = -1.0 * cos(y * VAR(fy));
double tx = lerp(FTx, sx, VAR(ax)), ty = lerp(FTy, sy, VAR(ay)), tz = FTz;
FPx += VVAR * tx;
FPy += VVAR * ty;
FPz += VVAR * tz;
return TRUE;
}

68
Plugin/split.c Normal file
View File

@ -0,0 +1,68 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double split_xsize;
double split_ysize;
// precacluated values
double xang;
double yang;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("split");
// Define the Variables
APO_VARIABLES(
VAR_REAL(split_xsize, 0.5),
VAR_REAL(split_ysize, 0.5)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(xang) = M_PI * VAR(split_xsize);
VAR(yang) = M_PI * VAR(split_ysize);
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
if (cos(FTx * VAR(xang)) >= 0)
FPy += VVAR * FTy;
else
FPy -= VVAR * FTy;
if (cos(FTy * VAR(yang)) >= 0)
FPx += VVAR * FTx;
else
FPx -= VVAR * FTx;
return TRUE;
}

69
Plugin/stripes.c Normal file
View File

@ -0,0 +1,69 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Joel Faber
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double stripes_space;
double stripes_warp;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("stripes");
// Define the Variables
APO_VARIABLES(
VAR_REAL_RANGE(stripes_space, 0.0, 1.0, 0.5),
VAR_REAL(stripes_warp, 0.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
// Always return TRUE.
return TRUE;
}
inline double rint(double x)
{
int temp; temp = (x >= 0. ? (int)(x + 0.5) : (int)(x - 0.5));
return (double)temp;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double roundx;
double offsetx;
roundx = (double)rint(FTx);
offsetx = FTx - roundx;
FPx += VVAR * ( offsetx * (1.0 - VAR(stripes_space)) + roundx);
FPy += VVAR * (FTy + offsetx * offsetx * VAR(stripes_warp));
return TRUE;
}

62
Plugin/stwins.c Normal file
View File

@ -0,0 +1,62 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double swtin_distort;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("stwin");
APO_VARIABLES(
VAR_REAL(swtin_distort, 1.0)
);
int PluginVarPrepare(Variation* vp)
{
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
// at multiplier=1 the function begins to overlap at 0.05 so we
// multiply with 0.05
const double multiplier = 0.05;
// then do the rest
double x = FTx * VVAR * multiplier;
double y = FTy * VVAR * multiplier;
double x2 = x * x; double y2 = y * y;
double x_plus_y = x + y;
double x2_minus_y2 = x2 - y2;
double x2_plus_y2 = x2 + y2;
double result = x2_minus_y2 * sin(M_2PI * VAR(swtin_distort) * x_plus_y);
double divident = 1.0;
if (x2_plus_y2 != 0) divident = x2_plus_y2;
result /= divident;
FPx += VVAR * FTx + result;
FPy += VVAR * FTy + result;
return TRUE;
}

1056
Plugin/synth.c Normal file

File diff suppressed because it is too large Load Diff

53
Plugin/tan.c Normal file
View File

@ -0,0 +1,53 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("tan");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
// Always return TRUE.
return TRUE;
}
// Calculates the function z' = tan(z) = sin(z)/cos(z)
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double sinx, cosx, sinhy, coshy;
fsincos(2 * FTx, &sinx, &cosx);
sinhcosh(2 * FTy, &sinhy, &coshy);
double denom = VVAR / (cosx + coshy + EPS);
FPx += sinx * denom;
FPy += sinhy * denom;
return TRUE;
}

47
Plugin/twoface.c Normal file
View File

@ -0,0 +1,47 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("twoface");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
return TRUE; // Always return TRUE.
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double r = VVAR;
if (FTx > 0.0)
{
r /= sqr(FTx) + sqr(FTy);
}
FPx += r * FTx;
FPy += r * FTy;
return TRUE;
}

54
Plugin/unpolar.c Normal file
View File

@ -0,0 +1,54 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double unpolar_vvar;
double unpolar_vvar_2;
} Variables;
#define _USE_MATH_DEFINES
#define APO_NOVARIABLES
#define APO_VIRTUALVAR
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("unpolar");
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
VAR(unpolar_vvar) = VVAR / M_PI;
VAR(unpolar_vvar_2) = VAR(unpolar_vvar) * 0.5;
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double r = exp(FTy);
double c, s;
fsincos(FTx, &s, &c);
FPy += VAR(unpolar_vvar_2) * r * c;
FPx += VAR(unpolar_vvar_2) * r * s;
return TRUE;
}

66
Plugin/wavesn.c Normal file
View File

@ -0,0 +1,66 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double wavesn_freqx, wavesn_freqy;
double wavesn_scalex, wavesn_scaley;
double wavesn_incx, wavesn_incy;
int wavesn_power;
int absN;
double cN;
} Variables;
#include "apoplugin.h"
APO_PLUGIN("wavesn");
APO_VARIABLES(
VAR_REAL(wavesn_freqx, 2.0), VAR_REAL(wavesn_freqy, 2.0),
VAR_REAL(wavesn_scalex, 1.0), VAR_REAL(wavesn_scaley, 1.0),
VAR_REAL(wavesn_incx, 0.0), VAR_REAL(wavesn_incy, 0.0),
VAR_INTEGER_NONZERO(wavesn_power, 1.0)
);
int PluginVarPrepare(Variation* vp)
{
VAR(absN) = (int)abs(VAR(wavesn_power));
if (VAR(wavesn_power) == 0) VAR(wavesn_power) = 2;
VAR(cN) = 1.0 / VAR(wavesn_power) / 2;
return TRUE;
}
int PluginVarCalc(Variation* vp)
{
double angle = (atan2(FTy, FTx) + M_2PI * (rand() % (int)VAR(absN)))/ VAR(wavesn_power);
double r = VVAR * pow(sqr(FTx) + sqr(FTy), VAR(cN));
double sina = 0, cosa = 0;
fsincos(angle, &sina, &cosa);
double xn = r * cosa;
double yn = r * sina;
double siny = sin(VAR(wavesn_freqx) * yn); double sinx = sin(VAR(wavesn_freqy) * xn);
double dx = xn + 0.5 * (VAR(wavesn_scalex) * siny + fabs(xn) * VAR(wavesn_incx) * siny);
double dy = yn + 0.5 * (VAR(wavesn_scaley) * sinx + fabs(yn) * VAR(wavesn_incy) * sinx);
FPx += VVAR * dx;
FPy += VVAR * dy;
return TRUE;
}

68
Plugin/whorl.c Normal file
View File

@ -0,0 +1,68 @@
/*
Apophysis Plugin
Copyright (C) 2007-2009 Michael Faber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
double whorl_inside;
double whorl_outside;
} Variables;
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("whorl");
// Define the Variables
APO_VARIABLES(
VAR_REAL(whorl_inside, 1.0),
VAR_REAL(whorl_outside, 1.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
// Always return TRUE.
return TRUE;
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double a, r;
double sina, cosa;
r = sqrt(FTx*FTx + FTy*FTy);
if(r < VVAR)
{
a = atan2(FTy, FTx) + VAR(whorl_inside)/(VVAR - r);
}
else
{
a = atan2(FTy, FTx) + VAR(whorl_outside)/(VVAR - r);
}
fsincos(a, &sina, &cosa);
FPx += VVAR*r*cosa;
FPy += VVAR*r*sina;
return TRUE;
}

66
Plugin/xheart.c Normal file
View File

@ -0,0 +1,66 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct
{
double cosa, sina, rat;
double xheart_angle;
double xheart_ratio;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
APO_PLUGIN("xheart");
APO_VARIABLES(
VAR_REAL(xheart_angle, 0.0),
VAR_REAL(xheart_ratio, 0.0)
);
int PluginVarPrepare(Variation* vp)
{
double c, s; double ang = M_PI_4 + (0.5 * M_PI_4 * VAR(xheart_angle));
fsincos(ang, &s, &c); VAR(cosa) = c; VAR(sina) = s;
double r = 6 + 2 * VAR(xheart_ratio);
VAR(rat) = r;
return TRUE;
}
inline double lerp(double a, double b, double x) { x=(x<0)?0:x; x=(x>1)?1:x;return x+(b-a)*x; }
int PluginVarCalc(Variation* vp)
{
double r2_4 = sqr(FTx) + sqr(FTy) + 4;
if (r2_4 == 0) r2_4 = 1;
double bx = 4 / r2_4, by = VAR(rat) / r2_4;
double x = VAR(cosa) * (bx*FTx) - VAR(sina) * (by*FTy);
double y = VAR(sina) * (bx*FTx) + VAR(cosa) * (by*FTy);
if (x > 0) {
FPx += VVAR * x;
FPy += VVAR * y;
} else {
FPx += VVAR * x;
FPy += -VVAR * y;
}
return TRUE;
}

295
Plugin/xtrb.c Normal file
View File

@ -0,0 +1,295 @@
/*
Apophysis Plugin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
Some comments on TriBorders plugin structure. It builds dual tessellation
on triangle grid as Boarders variation does for square one and it uses
trilinear coordinates ([link])
instead of usual Cartesian system (from where Tri Borders in plugin name).
Hex function doesn<73>t work correctly in general case because its second part
(determines nonlinear texture) doesn<73>t transform lines (passes from triangle vertex)
to itself for arbitrary triangle.
It possible to do and I<>ve done main job but have not finished.
*/
// Must define this structure before we include apoplugin.h
typedef struct
{
int xtrb_power;
double xtrb_dist;
double xtrb_radius, xtrb_width, xtrb_a, xtrb_b;
double angle_Ar, angle_Br, angle_Cr;
double sinA2, cosA2, sinB2, cosB2, sinC2, cosC2, sinC, cosC;
double a, b, c;
double Ha, Hb, Hc, S2;
double ab, ac, ba, bc, ca, cb, S2a, S2b, S2c, S2ab, S2ac, S2bc;
double width1, width2, width3;
double absN, cN;
} Variables;
#define _USE_MATH_DEFINES
#include "apoplugin.h"
// Set the name of this plugin
APO_PLUGIN("xtrb");
// Define the Variables
APO_VARIABLES(
VAR_INTEGER_NONZERO(xtrb_power, 2),
VAR_REAL(xtrb_radius, 1.0),
VAR_REAL(xtrb_width, 0.5),
VAR_REAL(xtrb_dist, 1.0),
VAR_REAL(xtrb_a, 1.0),
VAR_REAL(xtrb_b, 1.0)
);
// You must call the argument "vp".
int PluginVarPrepare(Variation* vp)
{
//VAR(angle_B)= 60;
//VAR(angle_C)= 60;
VAR(angle_Br) = 0.047 + VAR(xtrb_a);///180.0*M_PI; // angeles in radians
VAR(angle_Cr) = 0.047 + VAR(xtrb_b);///180.0*M_PI;
VAR(angle_Ar) =M_PI - VAR(angle_Br) - VAR(angle_Cr);
fsincos(0.5*VAR(angle_Ar), &VAR(sinA2), &VAR(cosA2)); // its sin, cos
fsincos(0.5*VAR(angle_Br), &VAR(sinB2), &VAR(cosB2));
fsincos(0.5*VAR(angle_Cr), &VAR(sinC2), &VAR(cosC2));
fsincos( VAR(angle_Cr), &VAR(sinC), &VAR(cosC));
VAR(a) = VAR(xtrb_radius)*( VAR(sinC2)/VAR(cosC2)+ VAR(sinB2)/VAR(cosB2)); //sides
VAR(b) = VAR(xtrb_radius)*( VAR(sinC2)/VAR(cosC2)+ VAR(sinA2)/VAR(cosA2));
VAR(c) = VAR(xtrb_radius)*( VAR(sinB2)/VAR(cosB2)+ VAR(sinA2)/VAR(cosA2));
VAR(width1) = 1 - VAR(xtrb_width);
VAR(width2) = 2* VAR(xtrb_width);
VAR(width3) = 1 - VAR(xtrb_width)*VAR(xtrb_width);
VAR(S2) = VAR(xtrb_radius)*( VAR(a)+VAR(b) +VAR(c)); //square
VAR(Ha) = VAR(S2)/VAR(a)/6.0; //Hight div on 6.0
VAR(Hb) = VAR(S2)/VAR(b)/6.0;
VAR(Hc) = VAR(S2)/VAR(c)/6.0;
VAR(ab) = VAR(a)/VAR(b);// a div on b
VAR(ac) = VAR(a)/VAR(c);
VAR(ba) = VAR(b)/VAR(a);
VAR(bc) = VAR(b)/VAR(c);
VAR(ca) = VAR(c)/VAR(a);
VAR(cb) = VAR(c)/VAR(b);
VAR(S2a) = 6.0*VAR(Ha);
VAR(S2b) = 6.0*VAR(Hb);
VAR(S2c) = 6.0*VAR(Hc);
VAR(S2bc) =VAR(S2)/(VAR(b)+VAR(c))/6.0;
VAR(S2ab) =VAR(S2)/(VAR(a)+VAR(b))/6.0;
VAR(S2ac) =VAR(S2)/(VAR(a)+VAR(c))/6.0;
VAR(absN) = (int)abs(VAR(xtrb_power));
VAR(cN) = VAR(xtrb_dist) / VAR(xtrb_power) / 2;
// Always return TRUE.
return TRUE;
}
void DirectTrilinear(Variation* vp, double x, double y, double* Al, double* Be, double* Ga)
{
double U = y + VAR(xtrb_radius);
double V = x * VAR(sinC) - y * VAR(cosC) + VAR(xtrb_radius);
*Al =U;
*Be =V;
*Ga = VAR(S2c) - VAR(ac) * U - VAR(bc) * V;
}
void InverseTrilinear(Variation* vp, double Al, double Be, double* x, double* y)
{
double inx = (Be - VAR(xtrb_radius) +(Al - VAR(xtrb_radius))* VAR(cosC))/ VAR(sinC);
double iny = Al - VAR(xtrb_radius);
double sina = 0.0, cosa = 0.0;
double angle = (atan2(iny, inx) + M_2PI * (rand() % (int)VAR(absN)))/ VAR(xtrb_power);
double r = VVAR * pow(sqr(inx) + sqr(iny), VAR(cN));
fsincos(angle, &sina, &cosa);
*x = r * cosa;
*y = r * sina;
//*x = 0; *y = 0;
}
void Hex(Variation* vp, double Al, double Be, double Ga, double* Al1, double* Be1) // it's necessary
//to improve for correct work for any triangle
{
double Ga1, De1, R;
R = random01();
if (Be < Al)
{
if (Ga < Be)
{
if (R >= VAR(width3))
{
De1 = VAR(xtrb_width) * Be;
Ga1 = VAR(xtrb_width) * Ga;
}
else
{
Ga1 = VAR(width1) * Ga + VAR(width2)*VAR(Hc)* Ga / Be;
De1 = VAR(width1)*Be+VAR(width2)*VAR(S2ab)*(3 -Ga / Be);
}
*Al1 = VAR(S2a) - VAR(ba)* De1 - VAR(ca)* Ga1;
*Be1 = De1;
}
else
{
if (Ga < Al)
{
if (R >= VAR(width3))
{
Ga1 = VAR(xtrb_width) * Ga;
De1 = VAR(xtrb_width) * Be;
}
else
{
De1 = VAR(width1) * Be + VAR(width2)*VAR(Hb)* Be / Ga;
Ga1 = VAR(width1)*Ga+VAR(width2)*VAR(S2ac)*(3 -Be / Ga);
}
*Al1 = VAR(S2a) - VAR(ba)* De1 - VAR(ca)* Ga1;
*Be1 = De1;
}
else
{
if (R >= VAR(width3))
{
*Al1 = VAR(xtrb_width) * Al;
*Be1 = VAR(xtrb_width) * Be;
}
else
{
*Be1 = VAR(width1) * Be+VAR(width2)*VAR(Hb)* Be / Al;
*Al1 = VAR(width1) * Al+VAR(width2)*VAR(S2ac)*(3-Be /Al);
}
}
}
}
else
{
if (Ga < Al)
{
if (R >= VAR(width3))
{
De1 = VAR(xtrb_width) * Al;
Ga1 = VAR(xtrb_width) * Ga;
}
else
{
Ga1 = VAR(width1) * Ga+VAR(width2)*VAR(Hc)* Ga / Al;
De1 = VAR(width1) *Al+VAR(width2)*VAR(S2ab)*(3 -Ga /Al);
}
*Be1 = VAR(S2b) - VAR(ab)* De1 - VAR(cb)* Ga1;
*Al1 = De1;
}
else
{
if (Ga < Be)
{
if (R >= VAR(width3))
{
Ga1 = VAR(xtrb_width) * Ga;
De1 = VAR(xtrb_width) * Al;
}
else
{
De1 = VAR(width1) * Al + VAR(width2)*VAR(Ha)* Al / Ga;
Ga1 = VAR(width1)*Ga + VAR(width2)*VAR(S2bc)*(3 -Al/Ga);
}
*Be1 = VAR(S2b) - VAR(ab)* De1 - VAR(cb)* Ga1;
*Al1 = De1;
}
else
{
if (R >= VAR(width3))
{
*Be1 = VAR(xtrb_width) * Be;
*Al1 = VAR(xtrb_width) * Al;
}
else
{
*Al1 = VAR(width1) * Al + VAR(width2)*VAR(Ha)* Al / Be;
*Be1 = VAR(width1)*Be+VAR(width2)*VAR(S2bc)*(3-Al / Be);
}
}
}
}
}
// You must call the argument "vp".
int PluginVarCalc(Variation* vp)
{
double Alpha, Beta, Gamma, OffsetAl, OffsetBe, OffsetGa, X, Y;
int M, N;
// transfer to trilinear coordinates, normalized to real distances from triangle sides
DirectTrilinear(vp, FTx, FTy, &Alpha, &Beta, &Gamma);
M = floor(Alpha/VAR(S2a));
OffsetAl = Alpha - M*VAR(S2a);
N = floor(Beta/VAR(S2b));
OffsetBe = Beta - N*VAR(S2b);
OffsetGa = VAR(S2c) - VAR(ac)*OffsetAl - VAR(bc)*OffsetBe;
if ( OffsetGa > 0 )
{
Hex(vp, OffsetAl, OffsetBe, OffsetGa, &Alpha, &Beta);
}
else
{
OffsetAl = VAR(S2a) - OffsetAl;
OffsetBe = VAR(S2b) - OffsetBe;
OffsetGa = - OffsetGa;
Hex(vp, OffsetAl, OffsetBe, OffsetGa, &Alpha, &Beta);
Alpha = VAR(S2a) - Alpha;
Beta = VAR(S2b) - Beta;
}
Alpha = Alpha + M*VAR(S2a);
Beta = Beta + N*VAR(S2b);
InverseTrilinear(vp, Alpha, Beta, &X, &Y);
FPx += VVAR * X;
FPy += VVAR * Y;
return TRUE;
}