Search in sources :

Example 11 with XYZPoint

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

the class Stereo3dFlameRendererView method initView.

@Override
public void initView() {
    super.initView();
    focalOffset = flame.getStereo3dFocalOffset();
    double eyeDist = 0.0;
    double eyeAngle = 0.0;
    switch(eye) {
        case LEFT:
            eyeAngle = flame.getAnaglyph3dAngle() * M_PI / 180.0;
            eyeDist = -flame.getAnaglyph3dEyeDist();
            break;
        case RIGHT:
            eyeAngle = -flame.getAnaglyph3dAngle() * M_PI / 180.0;
            eyeDist = flame.getAnaglyph3dEyeDist();
            break;
        default:
            // nothing to do
            break;
    }
    sinEye = sin(eyeAngle);
    cosEye = cos(eyeAngle);
    // always force 3d projection
    doProject3D = true;
    this.eyeOff = new XYZPoint();
    this.eyeOff.x = eyeDist;
    super.applyCameraMatrix(this.eyeOff);
}
Also used : XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Example 12 with XYZPoint

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

the class DefaultRenderIterationState method preFuseIter.

public void preFuseIter() {
    // affine part of the transformation
    affineT = new XYZPoint();
    // complete transformation
    varT = new XYZPoint();
    p = new XYZPoint();
    q = new XYZPoint();
    p.x = 2.0 * randGen.random() - 1.0;
    p.y = 2.0 * randGen.random() - 1.0;
    p.z = 0.0;
    p.color = randGen.random();
    p.material = randGen.random();
    p.modGamma = 0.0;
    p.modContrast = 0.0;
    p.modSaturation = 0.0;
    p.modHue = 0.0;
    xf = layer.getXForms().get(0);
    transformPoint();
    for (int i = 0; i <= Constants.INITIAL_ITERATIONS; i++) {
        xf = selectNextXForm(xf);
        if (xf == null) {
            xf = layer.getXForms().get(0);
            return;
        }
        transformPoint();
    }
}
Also used : XYZPoint(org.jwildfire.create.tina.base.XYZPoint) XYZPoint(org.jwildfire.create.tina.base.XYZPoint) XYZProjectedPoint(org.jwildfire.create.tina.base.XYZProjectedPoint)

Example 13 with XYZPoint

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

the class DCTriTileFunc method init.

@Override
public void init(FlameTransformationContext pContext, Layer pLayer, XForm pXForm, double pAmount) {
    orig = new triangle();
    switch(tiling) {
        case 1:
            fiveFoldInit(t, orig);
            break;
        case 2:
            trihexInit(t, orig);
            break;
        case 3:
            equiThirdsInit(t, orig);
            break;
        case 4:
            ortInit(t, orig);
            break;
        case 5:
            pinwheelInit(t, orig);
            break;
        case 6:
            goldInit(t, orig);
            break;
    }
    genRand = pContext.getRandGen();
    t1 = new triangle();
    t2 = new triangle();
    p = new XYZPoint();
}
Also used : XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Example 14 with XYZPoint

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

the class DLA3DWFFunc method getRawSampleFromJunctMesh.

private Sample getRawSampleFromJunctMesh(double scale, double defaultColor, Matrix3D rotation) {
    Sample sample = new Sample();
    Face f = junctMesh.getFace(_randGen.random(junctMesh.getFaceCount()));
    Vertex rawP1 = junctMesh.getVertex(f.v1);
    Vertex rawP2 = junctMesh.getVertex(f.v2);
    Vertex rawP3 = junctMesh.getVertex(f.v3);
    if (junctColorMapHolder.isActive() && rawP1 instanceof VertexWithUV) {
        VertexWithUV p1 = nodeTransform((VertexWithUV) rawP1, junct_mesh_scale, scale, junctMesh.getBoundingBox(), rotation);
        VertexWithUV p2 = nodeTransform((VertexWithUV) rawP2, junct_mesh_scale, scale, junctMesh.getBoundingBox(), rotation);
        VertexWithUV p3 = nodeTransform((VertexWithUV) rawP3, junct_mesh_scale, scale, junctMesh.getBoundingBox(), rotation);
        // uniform sampling:  http://math.stackexchange.com/questions/18686/uniform-random-point-in-triangle
        double sqrt_r1 = MathLib.sqrt(_randGen.random());
        double r2 = _randGen.random();
        double a = 1.0 - sqrt_r1;
        double b = sqrt_r1 * (1.0 - r2);
        double c = r2 * sqrt_r1;
        double dx = a * p1.x + b * p2.x + c * p3.x;
        double dy = a * p1.y + b * p2.y + c * p3.y;
        double dz = a * p1.z + b * p2.z + c * p3.z;
        sample.x = dx;
        sample.y = dy;
        sample.z = dz;
        sample.color = defaultColor;
        double u = a * p1.u + b * p2.u + c * p3.u;
        double v = a * p1.v + b * p2.v + c * p3.v;
        if (junctColorMapHolder.isActive()) {
            double iu = GfxMathLib.clamp(u * (junctColorMapHolder.getColorMapWidth() - 1.0), 0.0, junctColorMapHolder.getColorMapWidth() - 1.0);
            double iv = GfxMathLib.clamp(junctColorMapHolder.getColorMapHeight() - 1.0 - v * (junctColorMapHolder.getColorMapHeight() - 1.0), 0, junctColorMapHolder.getColorMapHeight() - 1.0);
            int ix = (int) MathLib.trunc(iu);
            int iy = (int) MathLib.trunc(iv);
            XYZPoint colorHolder = new XYZPoint();
            junctColorMapHolder.applyImageColor(colorHolder, ix, iy, iu, iv);
            sample.color = junctUVColorMapper.getUVColorIdx(Tools.FTOI(colorHolder.redColor), Tools.FTOI(colorHolder.greenColor), Tools.FTOI(colorHolder.blueColor));
        }
    } else {
        Vertex p1 = nodeTransform(rawP1, junct_mesh_scale, scale, junctMesh.getBoundingBox(), rotation);
        Vertex p2 = nodeTransform(rawP2, junct_mesh_scale, scale, junctMesh.getBoundingBox(), rotation);
        Vertex p3 = nodeTransform(rawP3, junct_mesh_scale, scale, junctMesh.getBoundingBox(), rotation);
        // uniform sampling:  http://math.stackexchange.com/questions/18686/uniform-random-point-in-triangle
        double sqrt_r1 = MathLib.sqrt(_randGen.random());
        double r2 = _randGen.random();
        double a = 1.0 - sqrt_r1;
        double b = sqrt_r1 * (1.0 - r2);
        double c = r2 * sqrt_r1;
        double dx = a * p1.x + b * p2.x + c * p3.x;
        double dy = a * p1.y + b * p2.y + c * p3.y;
        double dz = a * p1.z + b * p2.z + c * p3.z;
        sample.x = dx;
        sample.y = dy;
        sample.z = dz;
        sample.color = defaultColor;
    }
    return sample;
}
Also used : Vertex(org.jwildfire.create.tina.variation.mesh.Vertex) XYZPoint(org.jwildfire.create.tina.base.XYZPoint) Face(org.jwildfire.create.tina.variation.mesh.Face) XYZPoint(org.jwildfire.create.tina.base.XYZPoint) VertexWithUV(org.jwildfire.create.tina.variation.mesh.VertexWithUV)

Example 15 with XYZPoint

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

the class DLAWFFunc method transform.

@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
    Point point = getRandomPoint();
    pVarTP.x += pAmount * point.x;
    pVarTP.y += pAmount * point.y;
    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