use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class ChecksFunc method transform.
@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
// Fixed checks plugin by Keeps and Xyrus02, http://xyrus02.deviantart.com/art/Checks-The-fixed-version-138967784?q=favby%3Aapophysis-plugins%2F39181234&qo=3
int isXY = (int) Math.rint(pAffineTP.x * _cs) + (int) Math.rint(pAffineTP.y * _cs);
// -X- This is just for code readability,
// if there is any impact on performance, its minimal :-)
double rnx = rnd * pContext.random();
double rny = rnd * pContext.random();
double dx, dy;
if (isXY % 2 == 0) {
// -X- The -VAR(checks_#) stuff caused the error!
dx = _ncx + rnx;
dy = _ncy;
} else {
dx = this.x;
dy = this.y + rny;
}
pVarTP.x += pAmount * (pAffineTP.x + dx);
pVarTP.y += pAmount * (pAffineTP.y + dy);
// neat lil variation does not kill 3Dness in hack & 7X
if (pContext.isPreserveZCoordinate()) {
pVarTP.z += pAmount * pAffineTP.z;
}
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class ColorMapHolder method applyImageColor.
public void applyImageColor(XYZPoint pVarTP, int ix, int iy, double iu, double iv) {
if (ix >= 0 && ix < colorMapWidth && iy >= 0 && iy < colorMapHeight) {
if (colorMap instanceof SimpleImage) {
if (blend_colormap > 0) {
int ix1 = ix + 1;
if (ix1 >= colorMapWidth)
ix1 = 0;
int iy1 = iy + 1;
if (iy1 >= colorMapHeight)
iy1 = 0;
double iufrac = MathLib.frac(iu);
double ivfrac = MathLib.frac(iv);
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix, iy));
int lur = toolPixel.r;
int lug = toolPixel.g;
int lub = toolPixel.b;
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix1, iy));
int rur = toolPixel.r;
int rug = toolPixel.g;
int rub = toolPixel.b;
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix, iy1));
int lbr = toolPixel.r;
int lbg = toolPixel.g;
int lbb = toolPixel.b;
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix1, iy1));
int rbr = toolPixel.r;
int rbg = toolPixel.g;
int rbb = toolPixel.b;
pVarTP.rgbColor = true;
pVarTP.redColor = GfxMathLib.blerp(lur, rur, lbr, rbr, iufrac, ivfrac);
pVarTP.greenColor = GfxMathLib.blerp(lug, rug, lbg, rbg, iufrac, ivfrac);
pVarTP.blueColor = GfxMathLib.blerp(lub, rub, lbb, rbb, iufrac, ivfrac);
} else {
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix, iy));
pVarTP.rgbColor = true;
pVarTP.redColor = toolPixel.r;
pVarTP.greenColor = toolPixel.g;
pVarTP.blueColor = toolPixel.b;
}
} else {
if (blend_colormap > 0) {
int ix1 = ix + 1;
if (ix1 >= colorMapWidth)
ix1 = 0;
int iy1 = iy + 1;
if (iy1 >= colorMapHeight)
iy1 = 0;
double iufrac = MathLib.frac(iu);
double ivfrac = MathLib.frac(iv);
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix, iy);
float lur = rgbArray[0];
float lug = rgbArray[1];
float lub = rgbArray[2];
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix1, iy);
float rur = rgbArray[0];
float rug = rgbArray[1];
float rub = rgbArray[2];
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix, iy1);
float lbr = rgbArray[0];
float lbg = rgbArray[1];
float lbb = rgbArray[2];
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix1, iy1);
float rbr = rgbArray[0];
float rbg = rgbArray[1];
float rbb = rgbArray[2];
pVarTP.rgbColor = true;
pVarTP.redColor = GfxMathLib.blerp(lur, rur, lbr, rbr, iufrac, ivfrac);
pVarTP.greenColor = GfxMathLib.blerp(lug, rug, lbg, rbg, iufrac, ivfrac);
pVarTP.blueColor = GfxMathLib.blerp(lub, rub, lbb, rbb, iufrac, ivfrac);
} else {
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix, iy);
pVarTP.rgbColor = true;
pVarTP.redColor = rgbArray[0];
pVarTP.greenColor = rgbArray[1];
pVarTP.blueColor = rgbArray[2];
}
}
} else {
pVarTP.rgbColor = true;
pVarTP.redColor = 0;
pVarTP.greenColor = 0;
pVarTP.blueColor = 0;
}
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class CircleLinearFunc method transform.
@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
/* CircleLinear by eralex, http://eralex61.deviantart.com/art/Circles-Plugins-126273412 */
double X, Y, Z, Z1, U, V;
int M, N;
M = (int) floor(0.5 * pAffineTP.x / this.Sc);
N = (int) floor(0.5 * pAffineTP.y / this.Sc);
X = pAffineTP.x - (M * 2 + 1) * this.Sc;
Y = pAffineTP.y - (N * 2 + 1) * this.Sc;
U = sqrt(X * X + Y * Y);
V = (0.3 + 0.7 * DiscretNoise2(M + 10, N + 3)) * this.Sc;
Z1 = DiscretNoise2(M + this.Seed, N);
if ((Z1 < this.Dens1) && (U < V)) {
if (this.Reverse > 0) {
if (Z1 < this.Dens1 * this.Dens2) {
X = this.K * X;
Y = this.K * Y;
} else {
Z = V / U * (1 - this.K) + this.K;
X = Z * X;
Y = Z * Y;
}
} else {
if (Z1 > this.Dens1 * this.Dens2) {
X = this.K * X;
Y = this.K * Y;
} else {
Z = V / U * (1 - this.K) + this.K;
X = Z * X;
Y = Z * Y;
}
}
}
pVarTP.x += pAmount * (X + (M * 2 + 1) * this.Sc);
pVarTP.y += pAmount * (Y + (N * 2 + 1) * this.Sc);
if (pContext.isPreserveZCoordinate()) {
pVarTP.z += pAmount * pAffineTP.z;
}
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class CircleRandFunc method transform.
@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
/* CircleRand by eralex, http://eralex61.deviantart.com/art/Circles-Plugins-126273412 */
double X, Y, U;
int M, N;
final int maxIter = 100;
int iter = 0;
do {
X = this.X * (1.0 - 2.0 * pContext.random());
Y = this.Y * (1.0 - 2.0 * pContext.random());
M = (int) floor(0.5 * X / this.Sc);
N = (int) floor(0.5 * Y / this.Sc);
X = X - (M * 2 + 1) * this.Sc;
Y = Y - (N * 2 + 1) * this.Sc;
U = sqrt(X * X + Y * Y);
if (++iter > maxIter) {
break;
}
} while ((DiscretNoise2(M + this.Seed, N) > this.Dens) || (U > (0.3 + 0.7 * DiscretNoise2(M + 10, N + 3)) * this.Sc));
pVarTP.x += pAmount * (X + (M * 2 + 1) * this.Sc);
pVarTP.y += pAmount * (Y + (N * 2 + 1) * this.Sc);
if (pContext.isPreserveZCoordinate()) {
pVarTP.z += pAmount * pAffineTP.z;
}
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class CrownFunc method transform.
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
// Roger Bagula Reference:
// http://paulbourke.net/fractals/crown/
double x, y, z;
double t = (-M_PI + 2.0 * M_PI * pContext.random());
Complex wt = new Complex(0.0, 0.0);
for (int k = 1; k < 15; k++) {
double denom = MathLib.pow(a, b * k);
double th = MathLib.pow(a, (double) k) * MathLib.pow(-1.0, (double) k) * t;
wt.Add(new Complex(sin(th) / denom, cos(th) / denom));
}
x = wt.re;
y = wt.im;
z = MathLib.pow(wt.Mag2(), 2);
pVarTP.x += x * pAmount;
pVarTP.y += y * pAmount;
pVarTP.z += z * pAmount;
pVarTP.color = fmod(fabs((sqr(pVarTP.x) + sqr(pVarTP.y))), 1.0);
}
Aggregations