Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Li Apophysis Plugin
- Copyright 2011 Branden Brown, a.k.a. zephyrtronium
- This plugin is free software; you can redistribute it and/or modify
- them under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
- This plugin is distributed in the hope that they 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 plugin; if not, see <http://www.gnu.org/licenses/>.
- */
- typedef struct
- {
- } Variables;
- #include "apoplugin.h"
- APO_PLUGIN("Li");
- APO_VARIABLES(
- );
- int PluginVarPrepare(Variation* vp)
- {
- return TRUE;
- }
- static const double c[64] =
- {
- 0.5, 0.3333333333333333, 0.25, 0.2, 0.16666666666666666, 0.14285714285714285,
- 0.125, 0.1111111111111111, 0.1, 0.09090909090909091, 0.08333333333333333,
- 0.07692307692307693, 0.07142857142857142, 0.06666666666666667, 0.0625,
- 0.058823529411764705, 0.05555555555555555, 0.05263157894736842, 0.05,
- 0.047619047619047616, 0.045454545454545456, 0.043478260869565216,
- 0.041666666666666664, 0.04, 0.038461538461538464, 0.037037037037037035,
- 0.03571428571428571, 0.034482758620689655, 0.03333333333333333,
- 0.03225806451612903, 0.03125, 0.030303030303030304, 0.029411764705882353,
- 0.02857142857142857, 0.027777777777777776, 0.02702702702702703,
- 0.02631578947368421, 0.02564102564102564, 0.025, 0.024390243902439025,
- 0.023809523809523808, 0.023255813953488372, 0.022727272727272728,
- 0.022222222222222223, 0.021739130434782608, 0.02127659574468085,
- 0.020833333333333332, 0.02040816326530612, 0.02, 0.0196078431372549,
- 0.019230769230769232, 0.018867924528301886, 0.018518518518518517,
- 0.01818181818181818, 0.017857142857142856, 0.017543859649122806,
- 0.017241379310344827, 0.01694915254237288, 0.016666666666666666,
- 0.01639344262295082, 0.016129032258064516, 0.015873015873015872, 0.015625
- };
- int PluginVarCalc(Variation* vp)
- {
- double x, y, sx, sy, tx, ty;
- x = 0.5 * log(sqr(FTy) + sqr(FTx)));
- y = atan2(FTy, FTx);
- sx = tx = x;
- sy = ty = y;
- int k;
- for(k = 0; k < 64; k++)
- {
- double ik = c[k];
- double a = (tx * x - ty * y) * ik, b = (tx * y + ty * x) * ik;
- double rx = a * ik, ry = b * ik;
- if (sqr(rx) + sqr(ry) < EPS)
- break;
- tx = a;
- ty = b;
- sx += rx;
- sy += ry;
- }
- FPx += VVAR * (sx + 0.57721566490153286061 + 0.5 * log(sqr(y) + sqr(x)));
- FPy += VVAR * (sy + atan2(y, x));
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement