Пример #1
0
  @Override
  public void transform(
      FlameTransformationContext pContext,
      XForm pXForm,
      XYZPoint pAffineTP,
      XYZPoint pVarTP,
      double pAmount) {
    double wedgeJulia_cf = 1.0 - angle * count * M_1_PI * 0.5;
    double wedgeJulia_rN = fabs(power);
    double wedgeJulia_cn = dist / power / 2.0;
    /* wedge_julia from apo plugin pack */

    double r = pAmount * pow(pAffineTP.getPrecalcSumsq(), wedgeJulia_cn);
    int t_rnd = (int) ((wedgeJulia_rN) * pContext.random());
    double a = (pAffineTP.getPrecalcAtanYX() + 2.0 * M_PI * t_rnd) / power;
    double c = floor((count * a + M_PI) * M_1_PI * 0.5);

    a = a * wedgeJulia_cf + c * angle;
    double sa = sin(a);
    double ca = cos(sa);

    pVarTP.x += r * ca;
    pVarTP.y += r * sa;
    if (pContext.isPreserveZCoordinate()) {
      pVarTP.z += pAmount * pAffineTP.z;
    }
  }
Пример #2
0
 @Override
 public void transform(
     FlameTransformationContext pContext,
     XForm pXForm,
     XYZPoint pAffineTP,
     XYZPoint pVarTP,
     double pAmount) {
   double x = (this._isodd != 0) ? pAffineTP.x : this._vvar * atan2(pAffineTP.x, pAffineTP.y);
   double y =
       (this._isodd != 0)
           ? pAffineTP.y
           : this._vvar_2 * log(pAffineTP.x * pAffineTP.x + pAffineTP.y * pAffineTP.y);
   double angle =
       (atan2(y, x) + M_2PI * (pContext.random(Integer.MAX_VALUE) % (int) this._absn)) / this._nnz;
   double r = pAmount * pow(sqr(x) + sqr(y), this._cn) * ((this._isodd == 0) ? 1.0 : this.parity);
   double sina = sin(angle);
   double cosa = cos(angle);
   cosa *= r;
   sina *= r;
   x = (this._isodd != 0) ? cosa : (this._vvar_2 * log(cosa * cosa + sina * sina));
   y = (this._isodd != 0) ? sina : (this._vvar * atan2(cosa, sina));
   pVarTP.x += x;
   pVarTP.y += y;
   if (pContext.isPreserveZCoordinate()) {
     pVarTP.z += pAmount * pAffineTP.z;
   }
 }
Пример #3
0
 public void transformPower1(
     FlameTransformationContext pContext,
     XForm pXForm,
     XYZPoint pAffineTP,
     XYZPoint pVarTP,
     double pAmount) {
   pVarTP.x = pVarTP.x + pAmount * pAffineTP.x;
   pVarTP.y = pVarTP.y + pAmount * pAffineTP.y;
   if (pContext.isPreserveZCoordinate()) {
     pVarTP.z += pAmount * pAffineTP.z;
   }
 }
Пример #4
0
 @Override
 public void transform(
     FlameTransformationContext pContext,
     XForm pXForm,
     XYZPoint pAffineTP,
     XYZPoint pVarTP,
     double pAmount) {
   pVarTP.x += pAmount * sin(pAffineTP.x);
   pVarTP.y += pAmount * pAffineTP.y;
   if (pContext.isPreserveZCoordinate()) {
     pVarTP.z += pAmount * pAffineTP.z;
   }
 }
Пример #5
0
  @Override
  public void transform(
      FlameTransformationContext pContext,
      XForm pXForm,
      XYZPoint pAffineTP,
      XYZPoint pVarTP,
      double pAmount) {
    // nBlur by FractalDesire, http://fractaldesire.deviantart.com/art/nBlur-plugin-190401515
    // *********Adjustment of width of shape*********
    if (this.adjustToLinear == TRUE) {
      if ((this.numEdges) % 4 == 0) {
        pAmount /=
            sqrt(2.0 - 2.0 * cos(this._midAngle * ((double) this.numEdges / 2.0 - 1.0))) / 2.0;
      } else {
        pAmount /=
            sqrt(2.0 - 2.0 * cos(this._midAngle * floor(((double) this.numEdges / 2.0)))) / 2.0;
      }
    }
    //
    randXY(pContext, _randXYData);

    // ********Exact calculation slower - interpolated calculation faster********
    if ((this.exactCalc == TRUE) && (this.circumCircle == FALSE)) {
      while ((_randXYData.lenXY < _randXYData.lenInnerEdges)
          || (_randXYData.lenXY > _randXYData.lenOuterEdges)) randXY(pContext, _randXYData);
    }
    if ((this.exactCalc == TRUE) && (this.circumCircle == TRUE)) {
      while (_randXYData.lenXY < _randXYData.lenInnerEdges) randXY(pContext, _randXYData);
    }
    double xTmp = _randXYData.x;
    double yTmp = _randXYData.y;

    // **************************************************************************

    // ********Begin of horizontal adjustment (rotation)********
    double x = this._cosa * xTmp - this._sina * yTmp;
    double y = this._sina * xTmp + this._cosa * yTmp;
    // *********End of horizontal adjustment (rotation)*********

    pVarTP.x += pAmount * x;
    pVarTP.y += pAmount * y;

    if (pContext.isPreserveZCoordinate()) {
      pVarTP.z += pAmount * pAffineTP.z;
    }
  }
Пример #6
0
 @Override
 public void transform(
     FlameTransformationContext pContext,
     XForm pXForm,
     XYZPoint pAffineTP,
     XYZPoint pVarTP,
     double pAmount) {
   double a = pAffineTP.getPrecalcAtan() * 0.5 + M_PI * (int) (2.0 * pContext.random());
   double sina = sin(a);
   double cosa = cos(a);
   double r = pAmount * sqrt(sqrt(pAffineTP.x * pAffineTP.x + pAffineTP.y * pAffineTP.y));
   pVarTP.x += r * cosa;
   pVarTP.y += r * sina;
   if (pContext.isPreserveZCoordinate()) {
     pVarTP.z += pAmount * pAffineTP.z;
   }
 }
Пример #7
0
 @Override
 public void transform(
     FlameTransformationContext pContext,
     XForm pXForm,
     XYZPoint pAffineTP,
     XYZPoint pVarTP,
     double pAmount) {
   /* Bent2 in the Apophysis Plugin Pack */
   double nx = pAffineTP.x;
   double ny = pAffineTP.y;
   if (nx < 0.0) nx = nx * x;
   if (ny < 0.0) ny = ny * y;
   pVarTP.x += pAmount * nx;
   pVarTP.y += pAmount * ny;
   if (pContext.isPreserveZCoordinate()) {
     pVarTP.z += pAmount * pAffineTP.z;
   }
 }
Пример #8
0
 public void transformPowerMinus2(
     FlameTransformationContext pContext,
     XForm pXForm,
     XYZPoint pAffineTP,
     XYZPoint pVarTP,
     double pAmount) {
   double a;
   if (pContext.random(2) == 0) a = atan2(pAffineTP.y, pAffineTP.x) / 2.0;
   else a = M_PI - atan2(pAffineTP.y, pAffineTP.x) / 2.0;
   double sina = sin(a);
   double cosa = cos(a);
   double r = pAmount / sqrt(sqrt(sqr(pAffineTP.x) + sqr(pAffineTP.y)));
   pVarTP.x = pVarTP.x + r * cosa;
   pVarTP.y = pVarTP.y - r * sina;
   if (pContext.isPreserveZCoordinate()) {
     pVarTP.z += pAmount * pAffineTP.z;
   }
 }
Пример #9
0
  public void transformFunction(
      FlameTransformationContext pContext,
      XForm pXForm,
      XYZPoint pAffineTP,
      XYZPoint pVarTP,
      double pAmount) {
    int rnd = pContext.random(absPower);
    double a;
    if ((rnd & 1) == 0) a = (2 * M_PI * rnd + atan2(pAffineTP.y, pAffineTP.x)) / power;
    else a = (2 * M_PI * rnd - atan2(pAffineTP.y, pAffineTP.x)) / power;
    double sina = sin(a);
    double cosa = cos(a);

    double r = pAmount * pow(sqr(pAffineTP.x) + sqr(pAffineTP.y), cPower);
    pVarTP.x = pVarTP.x + r * cosa;
    pVarTP.y = pVarTP.y + r * sina;
    if (pContext.isPreserveZCoordinate()) {
      pVarTP.z += pAmount * pAffineTP.z;
    }
  }
Пример #10
0
 @Override
 public void transform(
     FlameTransformationContext pContext,
     XForm pXForm,
     XYZPoint pAffineTP,
     XYZPoint pVarTP,
     double pAmount) {
   double sumsq = pAffineTP.getPrecalcSumsq();
   // Prevent divide by zero error
   if (sumsq == 0) {
     pVarTP.doHide = true;
   } else {
     double xfactor = xscale * pAffineTP.x + xshift;
     double yfactor = yscale * pAffineTP.y + yshift;
     pVarTP.x = (pAmount / sumsq) * sin(xfactor) * (cosh(yfactor) + ushift) * sqr(sin(xfactor));
     pVarTP.y += (pAmount / sumsq) * cos(xfactor) * (cosh(yfactor) + ushift) * sqr(sin(xfactor));
   }
   if (pContext.isPreserveZCoordinate()) {
     pVarTP.z += pAmount * pAffineTP.z;
   }
 }
Пример #11
0
  @Override
  public void transform(
      FlameTransformationContext pContext,
      XForm pXForm,
      XYZPoint pAffineTP,
      XYZPoint pVarTP,
      double pAmount) {
    // fibonacci2 by Larry Berlin, http://aporev.deviantart.com/gallery/#/d2blmhg
    //  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

    double a = pAffineTP.y * fnatlog;
    double snum1 = sin(a);
    double cnum1 = cos(a);
    double b = (pAffineTP.x * M_PI + pAffineTP.y * fnatlog) * -1.0;
    double snum2 = sin(b);
    double cnum2 = cos(b);

    double eradius1 = sc * exp(sc2 * (pAffineTP.x * fnatlog));
    double eradius2 = sc * exp(sc2 * ((pAffineTP.x * fnatlog - pAffineTP.y * M_PI) * -1));

    pVarTP.x += pAmount * (eradius1 * cnum1 - eradius2 * cnum2) * ffive;
    pVarTP.y += pAmount * (eradius1 * snum1 - eradius2 * snum2) * ffive;
    if (pContext.isPreserveZCoordinate()) {
      pVarTP.z += pAmount * pAffineTP.z;
    }
  }
Пример #12
0
  @Override
  public void transform(
      FlameTransformationContext pContext,
      XForm pXForm,
      XYZPoint pAffineTP,
      XYZPoint pVarTP,
      double pAmount) {
    // bwrands, by dark-beam
    double Vx, Vy; // V is "global" vector,
    double Cx, Cy; // C is "cell centre" vector
    double Lx, Ly; // L is "local" bubble vector
    double r, theta, s, c;
    double Vv2, flwr;

    Vx = pAffineTP.x;
    Vy = pAffineTP.y;

    if (fabs(cellsize) < SMALL_EPSILON) {
      // Linear if cells are too small
      pVarTP.x += pAmount * Vx;
      pVarTP.y += pAmount * Vy;
      if (pContext.isPreserveZCoordinate()) {
        pVarTP.z += pAmount * pAffineTP.z;
      }
      return;
    }

    int Ix = (int) floor(Vx / cellsize);
    int Iy = (int) floor(Vy / cellsize);

    Cx = (Ix + 0.5) * cellsize;
    Cy = (Iy + 0.5) * cellsize;

    // mess with Ix & Iy to get random
    int xx = Ix ^ 0xB641;
    int yy = Iy ^ 0x9D81;
    int xy = xx * yy + seed;
    xx &= 0xFFFF;
    yy &= 0xFFFF;
    xy &= 0xFFFF;
    // no less than 3 remixes are needed to get good randomness
    // use always identical mixes or you lose some data (you don't want this!)
    int tt = bytemix(xx, yy);
    yy = bytemix(yy, xx);
    xx = tt;
    tt = byteshf(xx, xy);
    yy = byteshf(xy, yy);
    xx = tt;
    tt = bytexim(xx, yy);
    yy = bytexim(yy, xx);
    xx = tt;
    double Ssz = ((double) xx) / 65535.0; // to get a range not 0-1 for circles size edit here
    Ssz = rmin + Ssz * (1.0 - rmin);
    double Aan =
        rrot
            * M_2PI
            * ((double) yy)
            / 65535.0; // to get a range not 0-2pi for rotations size edit here
    tt = byteprimes(xx, yy);
    yy = byteprimes(yy, xx);
    xx = tt;
    double LoonieChance = -((double) xx) / 65535.0 + loonie_chance; // 0.5 for a chance 50% !
    double PetalsChance = 0.0;
    if (LoonieChance < 0) PetalsChance = LoonieChance + petals_chance;
    // user choice but don't upset modulus...
    double NPetals;
    if (_pety == 0) NPetals = (double) _petx; // ... when min = max
    else
      NPetals =
          (double)
              (_petx
                  + (yy >> 3)
                      % (1 + _pety)); // yy last byte is not enough random. But yy >> 3 is good

    if (LoonieChance <= PetalsChance) LoonieChance = -1.0; // the bigger probability must win.

    // if more random values are needed remix again :D

    Lx = Vx - Cx;
    Ly = Vy - Cy;

    Vv2 = Ssz * _r2;

    if ((Lx * Lx + Ly * Ly) > Vv2) {
      // Linear if outside the bubble
      pVarTP.x += pAmount * Vx;
      pVarTP.y += pAmount * Vy;
      if (pContext.isPreserveZCoordinate()) {
        pVarTP.z += pAmount * pAffineTP.z;
      }
      return;
    }

    if (LoonieChance > 0.0) {
      // We're in the loonie!
      // r = Vv2 / (Lx * Lx + Ly * Ly) - MAX(MIN(VAR(bwrands_gain),1.0),0.0); LOOKING BAD!!!
      r = Vv2 / (Lx * Lx + Ly * Ly) - 1.0;
      r = sqrt(r);
      Lx *= r;
      Ly *= r;
      Vv2 = 1.0; // recycled var
    } else if (PetalsChance > 0.0) {
      // We're in the petals!
      flwr = NPetals / M_2PI * (M_PI + atan2(Ly, Lx));
      flwr = flwr - (int) (flwr);
      flwr = fabs(flwr - 0.5) * 2.0;
      r = sqrt(Lx * Lx + Ly * Ly);

      // We need a little chaos game to fill the empty space outside the flower.
      PetalsChance = pContext.random();

      if (PetalsChance < .5 * (flwr + .5)) {
        // petals
        Lx *= (1.0 - r) * (flwr * 1.1); // 1.1 remove the ugly border
        Ly *= (1.0 - r) * (flwr * 1.1); // 1.1 remove the ugly border
      } else {
        Vv2 = sqrt(Vv2); // dist to circle border
        // filling the rest of the circle
        Lx *= (Vv2 - r * (1.0 - flwr)) / (r + SMALL_EPSILON);
        Ly *= (Vv2 - r * (1.0 - flwr)) / (r + SMALL_EPSILON);
      }

      Vv2 = 1.0; // recycled var
    } else {
      // We're in the bubble!
      // Bubble distortion on local co-ordinates:
      Lx *= _g2;
      Ly *= _g2;
      r = _rfactor / ((Lx * Lx + Ly * Ly) / (4.0 * Ssz) + 1.0);
      Lx *= r;
      Ly *= r;
      Vv2 = sqrt(Ssz); // recycled var
    }
    // Spin around the centre:
    r = Vv2 * (Lx * Lx + Ly * Ly) / _r2; // r should be 0.0 - 1.0
    theta = inner_twist * (1.0 - r) + outer_twist * r;
    s = sin(theta + Aan);
    c = cos(theta + Aan);

    // Add rotated local vectors direct to centre (avoids use of temp storage)
    Vx = Cx + c * Lx + s * Ly;
    Vy = Cy - s * Lx + c * Ly;

    // Finally add values in
    pVarTP.x += pAmount * Vx;
    pVarTP.y += pAmount * Vy;
    if (pContext.isPreserveZCoordinate()) {
      pVarTP.z += pAmount * pAffineTP.z;
    }
  }