Search in sources :

Example 26 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class Scry2Func method transform.

@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
    /* scry2 by dark-beam */
    double xrt = pAffineTP.x, yrt = pAffineTP.y, swp;
    // r2 = xrt; // normal
    // +star
    double r2 = xrt * _coss + fabs(yrt) * _sins;
    // placeholder
    double r1 = 0;
    double circle = sqrt(sqr(xrt) + sqr(yrt));
    int i;
    for (i = 0; i < sides - 1; i++) {
        // rotate around to get the the sides!!! :D
        swp = xrt * _cosa - yrt * _sina;
        yrt = xrt * _sina + yrt * _cosa;
        xrt = swp;
        // r2 = MAX(r2, xrt); // normal
        // +star
        r2 = Math.max(r2, xrt * _coss + fabs(yrt) * _sins);
    }
    // +circle
    r2 = r2 * _cosc + circle * _sinc;
    r1 = r2;
    if (i > 1) {
        // we want it squared, for the pretty effect
        r2 = sqr(r2);
    } else {
        // 2-faces effect JUST FOR i=1
        r2 = fabs(r2) * r2;
    }
    // scry effect:
    double d = (r1 * (r2 + 1.0 / pAmount));
    if (d == 0) {
        return;
    }
    double r = 1.0 / d;
    pVarTP.x += pAffineTP.x * r;
    pVarTP.y += pAffineTP.y * r;
    if (pContext.isPreserveZCoordinate()) {
        pVarTP.z += pAmount * pAffineTP.z;
    }
}
Also used : XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Example 27 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class ShredlinFunc method transform.

@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
    // Shredlin by Zy0rg
    double sxd = xdistance;
    double sxw = xwidth;
    double syd = ydistance;
    double syw = ywidth;
    double vv = pAmount;
    int xpos = pAffineTP.x < 0 ? 1 : 0;
    int ypos = pAffineTP.y < 0 ? 1 : 0;
    double xrng = pAffineTP.x / sxd;
    double yrng = pAffineTP.y / syd;
    pVarTP.x = vv * sxd * ((xrng - (int) xrng) * sxw + (int) xrng + (0.5 - xpos) * (1 - sxw));
    pVarTP.y = vv * syd * ((yrng - (int) yrng) * syw + (int) yrng + (0.5 - ypos) * (1 - syw));
    if (pContext.isPreserveZCoordinate()) {
        pVarTP.z += pAmount * pAffineTP.z;
    }
}
Also used : XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Example 28 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class SiercarpetFunc method transform.

public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
    // Cross Carpet by Roger Bagula  Reference:
    // http://paulbourke.net/fractals/crosscarpet/roger21.basic
    double x = 1.0, y = 1.0;
    for (int i = 1; i <= m; i++) {
        a[2 * i - 1] = cos(2.0 * M_PI * (double) i / (double) m);
        b[2 * i - 1] = sin(2.0 * M_PI * (double) i / (double) m);
    }
    for (int i = 1; i <= m; i++) {
        a[2 * i] = (cos(2.0 * M_PI * i / (double) m) + cos(2.0 * M_PI * (i - 1) / (double) m)) / 2.0;
        b[2 * i] = (sin(2.0 * M_PI * i / (double) m) + sin(2.0 * M_PI * (i - 1) / (double) m)) / 2.0;
    }
    int l = 1 + (int) (2.0 * (double) m * pContext.random());
    if (d % (2 * m) != (5) % 2 * m) {
        d = 1;
        x = pAffineTP.x / 3.0 + (a[l] - b[l]) / MathLib.sqrt(2.0);
        y = pAffineTP.y / 3.0 + (a[l] + b[l]) / MathLib.sqrt(2.0);
    }
    pVarTP.x += x * pAmount;
    pVarTP.y += y * pAmount;
    if (pContext.isPreserveZCoordinate()) {
        pVarTP.z += pAmount * pAffineTP.z;
    }
// pVarTP.color = fmod(fabs( (sqr(pVarTP.x) + sqr(pVarTP.y ))), 1.0);
}
Also used : XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Example 29 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class SubFlameWFFunc method prefuseIter.

private void prefuseIter(FlameTransformationContext pContext) {
    if (flame != null) {
        Layer layer = flame.getFirstLayer();
        layer.refreshModWeightTables(pContext);
        xf = layer.getXForms().get(0);
        p = new XYZPoint();
        p.x = pContext.random() - 0.5;
        p.y = pContext.random() - 0.5;
        p.z = 0.0;
        p.color = pContext.random();
        for (int i = 0; i < 42; i++) {
            xf = xf.getNextAppliedXFormTable()[pContext.random(Constants.NEXT_APPLIED_XFORM_TABLE_SIZE)];
            if (xf == null) {
                return;
            }
            a.clear();
            v.clear();
            xf.transformPoint(pContext, a, v, p, p);
        }
    }
}
Also used : XYZPoint(org.jwildfire.create.tina.base.XYZPoint) Layer(org.jwildfire.create.tina.base.Layer) XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Example 30 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class SphericalNFunc method transform.

@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
    // SphericalN by eralex61, http://eralex61.deviantart.com/art/SphericalN-plugin-166218657?q=gallery%3Aapophysis-plugins%2F24607713&qo=36
    // R=sqrt(sqr(pAffineTP.x)+sqr(pAffineTP.y));
    double R = pow(sqrt(sqr(pAffineTP.x) + sqr(pAffineTP.y)), this.dist);
    int N = (int) floor(this.power * pContext.random());
    double alpha = atan2(pAffineTP.y, pAffineTP.x) + N * M_2PI / floor(this.power);
    double sina = sin(alpha);
    double cosa = cos(alpha);
    if (R > SMALL_EPSILON) {
        pVarTP.x += pAmount * cosa / R;
        pVarTP.y += pAmount * sina / R;
    }
    if (pContext.isPreserveZCoordinate()) {
        pVarTP.z += pAmount * pAffineTP.z;
    }
}
Also used : XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Aggregations

XYZPoint (org.jwildfire.create.tina.base.XYZPoint)102 XForm (org.jwildfire.create.tina.base.XForm)16 Layer (org.jwildfire.create.tina.base.Layer)13 Test (org.junit.Test)4 VectorD (org.jwildfire.base.mathlib.VecMathLib.VectorD)4 Flame (org.jwildfire.create.tina.base.Flame)4 ZigguratRandomGenerator (org.jwildfire.create.tina.random.ZigguratRandomGenerator)4 FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)4 SimpleHDRImage (org.jwildfire.image.SimpleHDRImage)4 SimpleImage (org.jwildfire.image.SimpleImage)4 Complex (org.jwildfire.base.mathlib.Complex)2 XYZProjectedPoint (org.jwildfire.create.tina.base.XYZProjectedPoint)2 Face (org.jwildfire.create.tina.variation.mesh.Face)2 Vertex (org.jwildfire.create.tina.variation.mesh.Vertex)2 VertexWithUV (org.jwildfire.create.tina.variation.mesh.VertexWithUV)2 RenderColor (org.jwildfire.create.tina.palette.RenderColor)1 CannabisCurveWFFunc (org.jwildfire.create.tina.variation.CannabisCurveWFFunc)1 CloverLeafWFFunc (org.jwildfire.create.tina.variation.CloverLeafWFFunc)1 DCPerlinFunc (org.jwildfire.create.tina.variation.DCPerlinFunc)1 FlowerFunc (org.jwildfire.create.tina.variation.FlowerFunc)1