Examples of XForm


Examples of org.jwildfire.create.tina.base.XForm

    boolean contRot = Math.random() < 0.5;
    double r0 = 0;

    for (int i = 0; i < maxXForms; i++) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      if (contRot) {
        r0 += 45.0 * Math.random() - 9.0 * Math.random();
        XFormTransformService.rotate(xForm, r0);
      }
      else {
        if (Math.random() < 0.5) {
          XFormTransformService.rotate(xForm, 360.0 * Math.random());
        }
        else {
          XFormTransformService.rotate(xForm, -360.0 * Math.random());
        }
      }
      XFormTransformService.localTranslate(xForm, (2.0 * Math.random() - 1.0) * tscl, (2.0 * Math.random() - 1.0) * tscl);
      scl *= 0.8 + Math.random() * 0.1;
      tscl *= 0.8 + Math.random() * 0.1;

      XFormTransformService.scale(xForm, scl, true, true);

      xForm.setColor(Math.random());
      xForm.addVariation(Math.random() * 0.5 + 0.5, new Linear3DFunc());
      xForm.setWeight(scl * Math.random() * 19.9 + 0.1);
    }
    return flame;
  }
View Full Code Here

Examples of org.jwildfire.create.tina.base.XForm

    double _3rdWeight = 0.5;
    double symmetry = 0.6 + Math.random() * 0.4;
    int sides = (int) (Math.random() * 11.0 + 2.0);
    // 1st XForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(wavesWeight);
      double varRnd = Math.random();
      VariationFunc w2;
      if (Math.random() > 0.5) {
        w2 = createExpWaves2Variation(scaleX, scaleY, freqX, freqY, varRnd);
      }
      else {
        if (Math.random() < 0.25) {
          w2 = GnarlRandomFlameGenerator.createWaves2Variation(scaleX, scaleY, freqX, freqY);
        }
        else {
          w2 = GnarlRandomFlameGenerator.createWaves2BVariation(scaleX, scaleY, freqX, freqY);
        }
      }

      xForm.addVariation(1, w2);

      switch ((int) (Math.random() * 36.0)) {
        case 0:
          xForm.addVariation(blurAmount, VariationFuncList.getVariationFuncInstance("blur", true));
          break;
        case 1:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("cos", true));
          break;
        case 2:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("exp", true));
          break;
        case 3:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("exponential", true));
          break;
        case 4:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("lazysusan", true));
          break;
        case 5:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("ngon", true));
          break;
        case 6:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("sech", true));
          break;
        case 7:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("sinh", true));
          break;
        case 8:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("epispiral_wf", true));
          break;
        case 9:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("tanh", true));
          break;
        case 10:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("twintrian", true));
          break;
        case 11:
          xForm.addVariation(blurAmount, VariationFuncList.getVariationFuncInstance("bubble", true));
          break;
        case 12:
          xForm.addVariation(nonBlurAmount, VariationFuncList.getVariationFuncInstance("epispiral", true));
          break;
        default: {
          int l = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
          String fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * l)];
          xForm.addVariation(blurAmount, VariationFuncList.getVariationFuncInstance(fName, true));
        }
      }

      xForm.setColorSymmetry(symmetry);
      xForm.setColor(0.9);
      if (Math.random() > 0.5) {
        XFormTransformService.scale(xForm, 0.9 + Math.random() * 0.09, true, true);
      }
      double angle, tx, ty;
      switch (sides) {
        case 2:
          angle = -180;
          tx = Math.random() * 8 - 4;
          ty = Math.random() * 8 - 4;
          break;
        case 3:
          angle = -120;
          tx = Math.random() * 8 - 4;
          ty = Math.random() * 8 - 4;
          break;
        case 4:
          angle = -90;
          tx = Math.random() * 8 - 4;
          ty = Math.random() * 8 - 4;
          break;
        case 5:
          angle = -72;
          tx = Math.random() * 7 - 3.5;
          ty = Math.random() * 7 - 3.5;
          break;
        case 6:
          angle = -60;
          tx = Math.random() * 7 - 3.5;
          ty = Math.random() * 7 - 3.5;
          break;
        case 7:
          angle = -51.42857;
          tx = Math.random() * 6 - 3;
          ty = Math.random() * 6 - 3;
          break;
        case 8:
          angle = -135;
          tx = Math.random() * 6 - 3;
          ty = Math.random() * 6 - 3;
          break;
        case 9:
          angle = -40;
          tx = Math.random() * 5 - 2.5;
          ty = Math.random() * 5 - 2.5;
          break;
        case 10:
          angle = -36;
          tx = Math.random() * 4 - 2;
          ty = Math.random() * 4 - 2;
          break;
        case 11:
          angle = -32.73;
          tx = Math.random() * 4.2 - 3;
          ty = Math.random() * 4.2 - 3;
          break;
        case 12:
          angle = -30;
          tx = Math.random() * 4.2 - 3;
          ty = Math.random() * 4.2 - 3;
          break;
        default:
          throw new IllegalStateException();
      }
      XFormTransformService.rotate(xForm, angle);
      XFormTransformService.localTranslate(xForm, tx, ty);
    }
    // 2nd XForm
    XForm secondXForm;
    {
      XForm xForm = secondXForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(_2ndWeight);
      int f = (int) (Math.random() * 4);
      switch (f) {
        case 0:
          xForm.addVariation(Math.random() * 0.7 + 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
          break;
        case 1:
          xForm.addVariation(Math.random() * 0.7 + 0.3, VariationFuncList.getVariationFuncInstance("bubble", true));
          xForm.addVariation(Math.random() * 0.7 + 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
          break;
        case 2:
          xForm.addVariation(Math.random() * 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
          JuliaNFunc juliaN = (JuliaNFunc) VariationFuncList.getVariationFuncInstance("julian", true);
          juliaN.setParameter("power", 50 - Math.random() * 100);
          juliaN.setParameter("dist", Math.random() * 10 - 2);
          xForm.addVariation(Math.random() * 0.06 + 0.1, juliaN);
          break;
        case 3:
          xForm.addVariation(Math.random() * 0.7 + 0.3, VariationFuncList.getVariationFuncInstance("spherical3D", true));
          break;
      }
      XFormTransformService.rotate(xForm, 180 - Math.random() * 360.0);
      if (Math.random() > 0.5) {
        XFormTransformService.scale(xForm, 0.5 + Math.random() * 1.0, true, true);
      }
      xForm.setColorSymmetry(-1);
    }
    // 3rd XForm
    if (Math.random() > 0.75) {
      if (Math.random() > 0.5) {
        secondXForm.setWeight(5 + Math.random() * 20.0);
      }
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(_3rdWeight);
      xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
      XFormTransformService.rotate(xForm, 180 - Math.random() * 360.0);
      XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random());
      xForm.setColorSymmetry(-1);
    }
    return flame;
  }
View Full Code Here

Examples of org.jwildfire.create.tina.base.XForm

    flame.setCamZoom(4.56);
    double posx[] = { -0.5, 0.5, 0.5, -0.5 };
    double posy[] = { -0.5, -0.5, 0.5, 0.5 };

    for (int i = 0; i < posx.length; i++) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5);
      xForm.setCoeff20(posx[i]);
      xForm.setCoeff21(posy[i]);
      xForm.setColor(Math.random());
      xForm.setColorSymmetry(Math.random());
      XFormTransformService.scale(xForm, 1.0, true, true);
      if (i == posx.length - 1) {
        if (Math.random() < 0.5) {
          xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance("linear3D", true));
          XFormTransformService.rotate(xForm, 5.0 - 10.0 * Math.random());
          XFormTransformService.localTranslate(xForm, 0.1 - 0.2 * Math.random(), 0.1 - 0.2 * Math.random());
          XFormTransformService.scale(xForm, 1.0 - 0.1 * Math.random(), Math.random() < 0.75, Math.random() > 0.25);
        }
        String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length)];
        xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance(fncName, true));
        if (Math.random() < 0.5) {
          XFormTransformService.scale(xForm, 1.0 - 0.1 * Math.random(), Math.random() < 0.75, Math.random() > 0.25);
        }
      }
      else {
        xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance("linear3D", true));
      }
    }
    return flame;
  }
View Full Code Here

Examples of org.jwildfire.create.tina.base.XForm

    // create a random gradient
    layer.setPalette(new TwoColorsRandomGradientGenerator().generatePalette(2, true));

    // create transform 1
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.1 + Math.random() * 0.7);
      xForm.setColor(0);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(-0.43686351); // a
      xForm.setCoeff10(0.63649767); // b
      xForm.setCoeff20(0.7325555); // e
      xForm.setCoeff01(-0.59864436); // c
      xForm.setCoeff11(-0.50111868); // d
      xForm.setCoeff21(0.08008955); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      // variation 1
      xForm.addVariation(0.125 + Math.random() * 0.125, VariationFuncList.getVariationFuncInstance("linear", true));
      // variation 2
      {
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("julian", true);
        varFunc.setParameter("power", 3);
        varFunc.setParameter("dist", 1);
        xForm.addVariation(0.6 + Math.random() * 0.4, varFunc);
      }
      // variation 3
      {
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("juliascope", true);
        varFunc.setParameter("power", 6);
        varFunc.setParameter("dist", 1);
        xForm.addVariation(0.6 + Math.random() * 0.3, varFunc);
      }
      XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), false);
      XFormTransformService.scale(xForm, 0.9 + Math.random() * 0.5, true, true, false);
      XFormTransformService.rotate(xForm, 360.0 * Math.random(), false);
    }
    // create transform 2
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.23272111);
      xForm.setColor(0.8);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(-0.15514012); // a
      xForm.setCoeff10(0.20816567); // b
      xForm.setCoeff20(0.19004075); // e
      xForm.setCoeff01(-0.15087636); // c
      xForm.setCoeff11(0.20174952); // d
      xForm.setCoeff21(-0.04671182); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      // variation 1
      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
      // variation 2
      {
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("juliascope", true);
        varFunc.setParameter("power", 2);
        varFunc.setParameter("dist", 1);
        xForm.addVariation(0.25 + Math.random() * 0.5, varFunc);
      }

      String fName;
      if (Math.random() < 0.33) {
        int idx = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
        fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * idx)];
      }
      else {
        fName = VariationFuncList.getRandomVariationname();
      }
      xForm.addVariation(0.18 - Math.random() * 0.36, VariationFuncList.getVariationFuncInstance(fName, true));
      XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), false);
      XFormTransformService.scale(xForm, 0.9 + Math.random() * 0.5, true, true, false);
      XFormTransformService.rotate(xForm, 360.0 * Math.random(), false);
    }
    // create transform 3
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.04166667);
      xForm.setColor(0.1);
      xForm.setColorSymmetry(0.75);

      xForm.setCoeff00(0.92931929); // a
      xForm.setCoeff10(0.17076568); // b
      xForm.setCoeff20(0.15869232); // e
      xForm.setCoeff01(-0.02999303); // c
      xForm.setCoeff11(0.67104838); // d
      xForm.setCoeff21(-0.19510192); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      // variation 1
      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
    }
    // create transform 4
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.04166667);
      xForm.setColor(0.15);
      xForm.setColorSymmetry(0.75);

      xForm.setCoeff00(0.53699507); // a
      xForm.setCoeff10(0.12206942); // b
      xForm.setCoeff20(-0.0380713); // e
      xForm.setCoeff01(0.23469299); // c
      xForm.setCoeff11(0.79862481); // d
      xForm.setCoeff21(0.04291273); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);
      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
    }
    // create transform 5
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.04166667);
      xForm.setColor(0.2);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(0.89779523); // a
      xForm.setCoeff10(-0.23112747); // b
      xForm.setCoeff20(-0.4497571); // e
      xForm.setCoeff01(0.1734196); // c
      xForm.setCoeff11(0.94619577); // d
      xForm.setCoeff21(-0.0672393); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
    }
    // create transform 6
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.04166667);
      xForm.setColor(0.25);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(0.70624241); // a
      xForm.setCoeff10(0.15652237); // b
      xForm.setCoeff20(0.43007701); // e
      xForm.setCoeff01(-0.04953437); // c
      xForm.setCoeff11(0.78838922); // d
      xForm.setCoeff21(0.21371425); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
    }
    // final transform
    if (Math.random() > 0.33) {
      XForm xForm = new XForm();
      layer.getFinalXForms().add(xForm);
      String finals[] = { "falloff2", "bwrands", "bwraps7", "cosine", "falloff3", "bwrands", "bwrands", "falloff2" };
      VariationFunc var = VariationFuncList.getVariationFuncInstance(finals[(int) (Math.random() * finals.length)], true);
      if (var.getName().equals("bwrands")) {
        var.setParameter("seed", (int) (Math.random() * Short.MAX_VALUE));
        var.setParameter("minpetals", (int) (3 + Math.random() * 3));
        var.setParameter("maxpetals", (int) (6 + Math.random() * 12));
      }
      if (var.getName().equals("bwrands") || var.getName().equals("bwraps7")) {
        var.setParameter("cellsize", 1.0 - Math.random() * 0.9);
        var.setParameter("space", Math.random() * 0.2);
        if (Math.random() > 0.5) {
          var.setParameter("inner_twist", 0.2 - Math.random() * 0.4);
          var.setParameter("outer_twist", 2.0 - Math.random() * 4.0);
        }
      }
      xForm.addVariation(1, var);
    }
    return flame;
  }
View Full Code Here

Examples of org.jwildfire.create.tina.base.XForm

    layer.getXForms().clear();

    int maxXForms = (int) (2.0 + Math.random() * 5.0);
    double scl = 1.0;
    for (int i = 0; i < maxXForms; i++) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      if (Math.random() < 0.5) {
        XFormTransformService.rotate(xForm, 360.0 * Math.random());
      }
      else {
        XFormTransformService.rotate(xForm, -360.0 * Math.random());
      }
      XFormTransformService.localTranslate(xForm, Math.random() - 1.0, Math.random() - 1.0);
      scl *= 0.75 + Math.random() / 4;
      XFormTransformService.scale(xForm, scl, true, true);

      xForm.setColor(Math.random());
      xForm.addVariation(Math.random() * 0.8 + 0.2, new Linear3DFunc());
      if (Math.random() > 0.33) {
        String[] fnc = FNCLST_ORIGINAL;
        int fncIdx = (int) (Math.random() * fnc.length);
        xForm.addVariation(Math.random() * 0.5, VariationFuncList.getVariationFuncInstance(fnc[fncIdx], true));
      }

      xForm.setWeight(Math.random() * 0.9 + 0.1);
    }
    return flame;
  }
View Full Code Here

Examples of org.jwildfire.create.tina.base.XForm

    layer.getFinalXForms().clear();
    layer.getXForms().clear();

    // create transform 1
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.1 + Math.random() * 0.4);
      xForm.setColor(0.74488914);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(0.75610133); // a
      xForm.setCoeff10(-0.74186252); // b
      xForm.setCoeff20(5.25778565); // e
      xForm.setCoeff01(0.74186252); // c
      xForm.setCoeff11(0.75610133); // d
      xForm.setCoeff21(-0.34949139); // f

      xForm.setPostCoeff00(-0.42606416);
      xForm.setPostCoeff10(0.44290131);
      xForm.setPostCoeff01(-0.10610689);
      xForm.setPostCoeff11(-0.40885976);
      xForm.setPostCoeff20(-2.81712);
      xForm.setPostCoeff21(7.390367);

      // variation 1
      xForm.addVariation(1.43, VariationFuncList.getVariationFuncInstance("bubble", true));
      // variation 2
      xForm.addVariation(0.012, VariationFuncList.getVariationFuncInstance("linear", true));
      // variation 3
      {
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("radial_blur", true);
        varFunc.setParameter("angle", 0.609835);
        xForm.addVariation(-0.249, varFunc);
      }
      // variation 4
      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("power", true));
      // random affine transforms (uncomment to play around)
      //   XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
      //   XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
      XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), false);
      // random affine post transforms (uncomment to play around)
      //   XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
      //   XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
      //   XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
    }
    // create transform 2
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(10.0 + Math.random() * 8.0);
      xForm.setColor(0.90312262);
      xForm.setColorSymmetry(0.95);

      xForm.setCoeff00(-0.85421287); // a
      xForm.setCoeff10(-0.63343313); // b
      xForm.setCoeff20(1.09379129); // e
      xForm.setCoeff01(-0.63343313); // c
      xForm.setCoeff11(0.85421287); // d
      xForm.setCoeff21(-0.20406326); // f

      xForm.setPostCoeff00(0.84389756);
      xForm.setPostCoeff10(-0.35800434);
      xForm.setPostCoeff01(0.43174917);
      xForm.setPostCoeff11(0.89637273);
      xForm.setPostCoeff20(-0.945758);
      xForm.setPostCoeff21(-0.4502584);

      // change relative weights
      xForm.getModifiedWeights()[0] = 2.05;
      xForm.getModifiedWeights()[1] = 1.25;
      xForm.getModifiedWeights()[2] = 0.9;

      // variation 1
      xForm.addVariation(0.008, VariationFuncList.getVariationFuncInstance("linear", true));
      // variation 2
      xForm.addVariation(10.72, VariationFuncList.getVariationFuncInstance("spherical", true));
      // random affine transforms (uncomment to play around)
      XFormTransformService.scale(xForm, 1.25 - Math.random() * 0.5, true, true, false);
      XFormTransformService.rotate(xForm, 36.0 * Math.random(), false);
      XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), false);
      // random affine post transforms (uncomment to play around)
      //   XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
      //   XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
      //   XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
    }
    // create transform 3
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.7);
      xForm.setColor(0.47272985);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(0.68724662); // a
      xForm.setCoeff10(-0.72642418); // b
      xForm.setCoeff20(-2.14812602); // e
      xForm.setCoeff01(0.72642418); // c
      xForm.setCoeff11(0.68724662); // d
      xForm.setCoeff21(2.39994214); // f

      xForm.setPostCoeff00(0.60646395);
      xForm.setPostCoeff10(0.79511098);
      xForm.setPostCoeff01(-0.79511098);
      xForm.setPostCoeff11(0.60646395);
      xForm.setPostCoeff20(-1.06135064);
      xForm.setPostCoeff21(-0.6369509);

      // variation 1
      {
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("bipolar", true);
        varFunc.setParameter("shift", 0);
        xForm.addVariation(1, varFunc);
      }
      // random affine transforms (uncomment to play around)
      //   XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
      //    XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
      //   XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
View Full Code Here

Examples of org.jwildfire.create.tina.base.XForm

    layer.getXForms().clear();

    int maxXForms = (int) (1.0 + Math.random() * 5.0);
    double scl = 1.0;
    for (int i = 0; i < maxXForms; i++) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      if (Math.random() < 0.5) {
        XFormTransformService.rotate(xForm, 360.0 * Math.random());
      }
      else {
        XFormTransformService.rotate(xForm, -360.0 * Math.random());
      }
      XFormTransformService.localTranslate(xForm, Math.random() - 1.0,
          Math.random() - 1.0);
      scl *= 0.75 + Math.random() / 4;
      XFormTransformService.scale(xForm, scl, true, true);

      xForm.setColor(Math.random());
      xForm.addVariation(Math.random() * 0.3 + 0.2, new Linear3DFunc());
      if (Math.random() > 0.1) {
        String[] fnc = FNCLST_EXPERIMENTAL;
        int fncIdx = (int) (Math.random() * fnc.length);
        xForm.addVariation(0.2 + Math.random() * 0.6, VariationFuncList
            .getVariationFuncInstance(fnc[fncIdx], true));
      }

      xForm.setWeight(Math.random() * 0.9 + 0.1);
    }
    return flame;
  }
View Full Code Here

Examples of org.jwildfire.create.tina.base.XForm

    double _3rdWeight = 0.5;
    double symmetry = 0.7 + Math.random() * 0.3;
    int sides = (int) (Math.random() * 8.0 + 3.0);
    // 1st XForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(wavesWeight);
      VariationFunc w2 = Math.random() > 0.89 ? createWaves2Variation(scaleX, scaleY, freqX, freqY) : createWaves2BVariation(scaleX, scaleY, freqX, freqY);
      xForm.addVariation(1 + Math.random() * 0.001, w2);

      String varLst[] = { "blur", "cos", "exp", "exponential", "lazysusan", "ngon", "sech", "sinh", "epispiral_wf", "tanh", "twintrian", "epispiral" };
      String varName = Math.random() > 0.25 ? varLst[(int) (Math.random() * varLst.length)] : VariationFuncList.getRandomVariationname();
      xForm.addVariation(blurAmount, VariationFuncList.getVariationFuncInstance(varName, true));
      xForm.setColorSymmetry(symmetry);
      xForm.setColor(0.9);
      if (Math.random() > 0.5) {
        XFormTransformService.scale(xForm, 0.995, true, true);
      }
      double angle, tx, ty;
      switch (sides) {
        case 3:
          angle = -120;
          tx = Math.random() * 8 - 4;
          ty = Math.random() * 8 - 4;
          break;
        case 4:
          angle = -90;
          tx = Math.random() * 8 - 4;
          ty = Math.random() * 8 - 4;
          break;
        case 5:
          angle = -72;
          tx = Math.random() * 7 - 3.5;
          ty = Math.random() * 7 - 3.5;
          break;
        case 6:
          angle = -60;
          tx = Math.random() * 7 - 3.5;
          ty = Math.random() * 7 - 3.5;
          break;
        case 7:
          angle = -51.42857;
          tx = Math.random() * 6 - 3;
          ty = Math.random() * 6 - 3;
          break;
        case 8:
          angle = -135;
          tx = Math.random() * 6 - 3;
          ty = Math.random() * 6 - 3;
          break;
        case 9:
          angle = -40;
          tx = Math.random() * 5 - 2.5;
          ty = Math.random() * 5 - 2.5;
          break;
        case 10:
          angle = -36;
          tx = Math.random() * 4 - 2;
          ty = Math.random() * 4 - 2;
          break;
        default:
          throw new IllegalStateException();
      }
      XFormTransformService.rotate(xForm, angle);
      XFormTransformService.localTranslate(xForm, tx * 1.5, ty * 1.5);
    }
    // 2nd XForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(_2ndWeight);
      int f = (int) (Math.random() * 3);
      switch (f) {
        case 0:
          xForm.addVariation(Math.random() * 0.37 + 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
          break;
        case 1:
          xForm.addVariation(Math.random() * 0.37 + 0.3, VariationFuncList.getVariationFuncInstance("bubble", true));
          xForm.addVariation(Math.random() * 0.37 + 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
          break;
        case 2:
          xForm.addVariation(Math.random() * 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
          JuliaNFunc juliaN = (JuliaNFunc) VariationFuncList.getVariationFuncInstance("julian", true);
          juliaN.setParameter("power", 50 - Math.random() * 100);
          juliaN.setParameter("dist", Math.random() * 10 - 2);
          xForm.addVariation(Math.random() * 0.06 + 0.1, juliaN);
          break;
      }
      xForm.setColorSymmetry(-1);
    }
    // 3rd XForm
    if (Math.random() > 0.75) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(_3rdWeight);
      xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
      XFormTransformService.rotate(xForm, 180 - Math.random() * 360.0);
      XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random());
      xForm.setColorSymmetry(-1);
    }
    return flame;
  }
View Full Code Here

Examples of org.jwildfire.create.tina.base.XForm

    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    int fncCount = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
    // 1st xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(12.0 + Math.random() * 80.0);
      xForm.addVariation(2 + Math.random() * 4, VariationFuncList.getVariationFuncInstance("spherical", true));

      String fName;
      if (Math.random() < 0.15) {
        fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * fncCount)];
      }
      else {
        fName = Math.random() < 0.8 ? "eyefish" : "fisheye";
      }
      xForm.addVariation(0.05 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance(fName, true));
      xForm.setColorSymmetry(0.991 + Math.random() * 0.08);
      XFormTransformService.scale(xForm, 0.5 - Math.random() * 0.5, true, true, false);
      XFormTransformService.rotate(xForm, 180 - Math.random() * 360.0, false);
      XFormTransformService.localTranslate(xForm, 3.0 - 6.0 * Math.random(), 3.0 - 6.0 * Math.random(), false);
      if (Math.random() < 0.33) {
        XFormTransformService.localTranslate(xForm, 0.75 - 1.5 * Math.random(), 0.75 - 1.5 * Math.random(), true);
      }
    }
    // 2nd xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5 + Math.random() * 0.8);
      if (Math.random() < 0.05) {
        xForm.addVariation(0.01 + Math.random() * 0.4, VariationFuncList.getVariationFuncInstance("bubble", true));
        VariationFunc checks = VariationFuncList.getVariationFuncInstance("checks", true);
        checks.setParameter("size", 5.0);
        checks.setParameter("x", 3.0);
        checks.setParameter("y", 3.0);
        xForm.addVariation(0.01 + Math.random() * 0.04, checks);
      }
      else {
        xForm.addVariation(0.1 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance("bubble", true));
      }
      xForm.addVariation(4 + Math.random() * 2, VariationFuncList.getVariationFuncInstance("pre_blur", true));
      xForm.setColorSymmetry(-0.5);
      XFormTransformService.scale(xForm, 1.1 + Math.random() * 1.9, true, true, false);
      XFormTransformService.localTranslate(xForm, 0.75 - 1.50 * Math.random(), 0.75 - 1.50 * Math.random(), false);
      XFormTransformService.rotate(xForm, 30 - Math.random() * 60.0, false);
    }

    // 3rd xForm
    if (Math.random() > 0.25) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5 + Math.random() * 1.5);
      String fName;
      if (Math.random() > 0.8) {
        fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * fncCount)];
      }
      else {
        fName = Math.random() > 0.5 ? "linear3D" : "noise";
      }
      xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance(fName, true));
      xForm.setColorSymmetry(-0.5);
      XFormTransformService.rotate(xForm, 30.0 - Math.random() * 60.0, false);
      if (Math.random() < 0.5) {
        XFormTransformService.scale(xForm, 0.5 + Math.random() * 1.5, true, true, false);
      }
    }
    // 4th xForm
    if (Math.random() > 0.5) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5 + Math.random() * 1.5);
      String fName;
      if (Math.random() > 0.8) {
        fName = Math.random() > 0.75 ? VariationFuncList.getRandomVariationname() : ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * fncCount)];
      }
      else {
        fName = Math.random() > 0.5 ? "linear3D" : "gaussian_blur";
      }
      xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance(fName, true));
      xForm.setColorSymmetry(-0.5);
      XFormTransformService.rotate(xForm, 30.0 - Math.random() * 60.0, false);
      if (Math.random() < 0.5) {
        XFormTransformService.scale(xForm, 0.15 + Math.random() * 1.25, true, true, false);
      }
    }
View Full Code Here

Examples of org.jwildfire.create.tina.base.XForm

    double centre_noise = .0;
    double centre_power = -1.0;
    double centre_smooth = 1;
    double centre_color = 0.4 + 0.2 * Math.random();
    double centre_symmetry = 0.6 + 0.4 * Math.random();
    XForm xForm1;
    // 1st XForm
    {
      XForm xForm = xForm1 = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(1.0);
      xForm.setColor(0.0);
      xForm.setColorSymmetry(-1.0);

      VariationFunc synth = VariationFuncList.getVariationFuncInstance("synth");
      xForm.addVariation(1.0, synth);
      synth.setParameter("mode", (int) (20 * Math.random())); //3;
      synth.setParameter("power", -0.2);

      int numWaves = (int) (Math.random() * 3.5 + 2);
      // Starting circle . . .
      synth.setParameter("a", 0.8 + (Math.random() * 0.4));
      // Wave #1
      synth.setParameter("b", Math.random() * 2);
      synth.setParameter("b_type", (int) (Math.random() * 7));
      synth.setParameter("b_frq", (int) (Math.random() * 7 + 1));
      synth.setParameter("b_phs", Math.random() * M_PI);
      synth.setParameter("b_layer", (int) (Math.random() * 4));
      // Skew effect?
      if (Math.random() < 0.2) {
        synth.setParameter("b_skew", Math.random() * 2 - 1);
      }
      // Exceptionally high frequency?
      if (Math.random() < 0.1) {
        synth.setParameter("b_frq", (int) (Math.random() * 20 + 7));
      }
      // Usually higher frequencies affect the amplitude
      if (Math.random() < 0.8) {
        synth.setParameter("b", (Double) synth.getParameter("b") / (1 + 0.3 * (Double) synth.getParameter("b_frq")));
      }

      // Wave #2
      synth.setParameter("c", Math.random());
      synth.setParameter("c_type", (int) (Math.random() * 7));
      synth.setParameter("c_frq", (int) (Math.random() * 7 + 1));
      synth.setParameter("c_phs", Math.random() * M_PI);
      synth.setParameter("c_layer", (int) (Math.random() * 4));
      // Skew effect?
      if (Math.random() < 0.2) {
        synth.setParameter("c_skew", Math.random() * 2 - 1);
      }
      // Exceptionally high frequency?
      if (Math.random() < 0.1) {
        synth.setParameter("c_frq", (int) (Math.random() * 20 + 7));
      }
      // Usually higher frequencies affect the amplitude
      if (Math.random() < 0.8) {
        synth.setParameter("c", (Double) synth.getParameter("c") / (1 + 0.3 * (Double) synth.getParameter("c_frq")));
      }

      // Wave #3
      if (numWaves >= 3) {
        synth.setParameter("d", Math.random());
        synth.setParameter("d_type", (int) (Math.random() * 7));
        synth.setParameter("d_frq", (int) (Math.random() * 7 + 1));
        synth.setParameter("d_phs", Math.random() * M_PI);
        synth.setParameter("d_layer", (int) (Math.random() * 4));
        // Skew effect?
        if (Math.random() < 0.2) {
          synth.setParameter("d_skew", Math.random() * 2 - 1);
        }
        // Exceptionally high frequency?
        if (Math.random() < 0.1) {
          synth.setParameter("d_frq", (int) (Math.random() * 20 + 7));
        }
        // Usually higher frequencies affect the amplitude
        if (Math.random() < 0.8) {
          synth.setParameter("d", (Double) synth.getParameter("d") / (1 + 0.3 * (Double) synth.getParameter("d_frq")));
        }
      }

      // Wave #4
      if (numWaves >= 4) {
        synth.setParameter("e", Math.random());
        synth.setParameter("e_type", (int) (Math.random() * 7));
        synth.setParameter("e_frq", (int) (Math.random() * 7 + 1));
        synth.setParameter("e_phs", Math.random() * M_PI);
        synth.setParameter("e_layer", (int) (Math.random() * 4));
        // Skew effect?
        if (Math.random() < 0.2) {
          synth.setParameter("e_skew", Math.random() * 2 - 1);
        }
        // Exceptionally high frequency?
        if (Math.random() < 0.1) {
          synth.setParameter("e_frq", (int) (Math.random() * 20 + 7));
        }
        // Usually higher frequencies affect the amplitude
        if (Math.random() < 0.8) {
          synth.setParameter("e", (Double) synth.getParameter("e") / (1 + 0.3 * (Double) synth.getParameter("e_frq")));
        }
      }

      // Wave #5
      if (numWaves >= 5) {
        synth.setParameter("f", Math.random());
        synth.setParameter("f_type", (int) (Math.random() * 7));
        synth.setParameter("f_frq", (int) (Math.random() * 7 + 1));
        synth.setParameter("f_phs", Math.random() * M_PI);
        synth.setParameter("f_layer", (int) (Math.random() * 4));
        // Skew effect?
        if (Math.random() < 0.2) {
          synth.setParameter("f_skew", Math.random() * 2 - 1);
        }
        // Exceptionally high frequency?
        if (Math.random() < 0.1) {
          synth.setParameter("f_frq", (int) (Math.random() * 20 + 7));
        }
        // Usually higher frequencies affect the amplitude
        if (Math.random() < 0.8) {
          synth.setParameter("f", (Double) synth.getParameter("f") / (1 + 0.3 * (Double) synth.getParameter("f_frq")));
        }
      }
    }

    // Second "inner" transform is smaller with a little noise
    // added to remove annoying lines at the centre
    {
      XForm xForm = xForm1.makeCopy();
      layer.getXForms().add(xForm);
      xForm.setWeight(1.0);
      xForm.setColor(centre_color);
      xForm.setColorSymmetry(centre_symmetry);

      VariationFunc synth = xForm.getVariation(0).getFunc();
      xForm.getVariation(0).setAmount(centre_synth);
      synth.setParameter("power", centre_power);
      synth.setParameter("mode", centre_mode);
      synth.setParameter("smooth", centre_smooth);

      VariationFunc noise = VariationFuncList.getVariationFuncInstance("noise");
      xForm.addVariation(centre_noise, noise);

    }

    if (Math.random() < 0.55) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(5 * Math.random() + 0.125);
      xForm.setColor(centre_color + 0.2 * Math.random());
      xForm.setColorSymmetry(centre_symmetry - 0.4 * Math.random());

      VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname());
      xForm.addVariation(0.25 + Math.random() * 1.5, varFunc);

      xForm.getModifiedWeights()[1] = 0.0;
    }

    return flame;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.