use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class Boarders2Test method testTransformYbigYNeg.
@Test
public void testTransformYbigYNeg() {
XYZPoint pt = new XYZPoint();
pt.y = -.4;
pt.x = .2;
pt.z = 1;
XYZPoint pt2 = new XYZPoint();
pt2.y = -.4;
pt2.x = .2;
pt2.z = 1;
Boarders2Func bf = new Boarders2Func();
bf.init(null, null, new XForm(), 10);
Flame f = new Flame();
f.setHeight(500);
f.setWidth(500);
f.setName("test1");
bf.transform(new FlameTransformationContext(new FlameRenderer(f, Prefs.getPrefs(), true, false), new ZigguratRandomGenerator(), 1), new XForm(), pt, pt2, 10);
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class Boarders2Test method testTransformXbigXPos.
@Test
public void testTransformXbigXPos() {
XYZPoint pt = new XYZPoint();
pt.y = .4;
pt.x = .5;
pt.z = 1;
XYZPoint pt2 = new XYZPoint();
pt2.y = .4;
pt2.x = .5;
pt2.z = 1;
Boarders2Func bf = new Boarders2Func();
bf.init(null, null, new XForm(), 10);
Flame f = new Flame();
f.setHeight(500);
f.setWidth(500);
f.setName("test1");
bf.transform(new FlameTransformationContext(new FlameRenderer(f, Prefs.getPrefs(), true, false), new ZigguratRandomGenerator(), 1), new XForm(), pt, pt2, 10);
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class Boarders2Test method testTransformXbigXNeg.
@Test
public void testTransformXbigXNeg() {
XYZPoint pt = new XYZPoint();
pt.y = .4;
pt.x = -.5;
pt.z = 1;
XYZPoint pt2 = new XYZPoint();
pt2.y = .4;
pt2.x = -.5;
pt2.z = 1;
Boarders2Func bf = new Boarders2Func();
bf.setParameter("right", 0);
bf.init(null, null, new XForm(), 10);
Flame f = new Flame();
f.setHeight(500);
f.setWidth(500);
f.setName("test1");
bf.transform(new FlameTransformationContext(new FlameRenderer(f, Prefs.getPrefs(), true, false), new ZigguratRandomGenerator(), 1), new XForm(), pt, pt2, 10);
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class DCTriTileFunc method transform.
@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
/* extension of FiveFold by eralex61, https://eralex61.deviantart.com/art/Five-fold-example-of-finite-recurent-system-in-Apo-705813367 */
t1.assign(orig);
t1.col = 0.25;
t2.assign(orig);
t2.col = 0.0;
int n = itt;
int k = 1;
while (n > 0) {
devis(t1, t2);
t1.assign(t2);
if (on == 0) {
if ((k == itt) && (t1.type != eq))
n = n + depth;
} else {
if ((k >= itt) && (k < itt + depth) && (t1.type != eq))
n = n + 1;
}
n = n - 1;
k = k + 1;
}
int m = 0;
switch(t1.type) {
case 1:
n = itt1;
k = 1;
while (n > 0) {
devis(t1, t2);
t1.assign(t2);
m = 2 * m + t2.type - 1;
if (on1 == 0) {
if ((k == itt1) && (t1.type != eq1))
n = n + depth1;
} else {
if ((k >= itt1) && (k < itt1 + depth1) && (t1.type != eq1))
n = n + 1;
}
n = n - 1;
k = k + 1;
}
t1.col = discretNoise(m + 43);
break;
case 2:
n = itt2;
k = 1;
while (n > 0) {
devis(t1, t2);
t1.assign(t2);
m = 2 * m + t2.type - 1;
if (on2 == 0) {
if ((k == itt2) && (t1.type != eq2))
n = n + depth2;
} else {
if ((k >= itt2) && (k < itt2 + depth2) && (t1.type != eq2))
n = n + 1;
}
n = n - 1;
k = k + 1;
}
t1.col = discretNoise(m + 31);
break;
}
t2.blur(p);
pVarTP.x += pAmount * p.x;
pVarTP.y += pAmount * p.y;
pVarTP.z += pAmount * p.z;
pVarTP.color = fmod(t1.col + t2.col, 1.0);
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class DCTriangleFunc method transform.
@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
/* dc_triangle by Xyrus02, http://apophysis-7x.org/extensions */
// set up triangle
// X
double xx = pXForm.getXYCoeff00(), xy = pXForm.getXYCoeff10();
// Y
double yx = pXForm.getXYCoeff01() * -1, yy = pXForm.getXYCoeff11() * -1;
// O
double ox = pXForm.getXYCoeff20(), oy = pXForm.getXYCoeff21();
// P
double px = pAffineTP.x - ox, py = pAffineTP.y - oy;
// calculate dot products
// X * X
double dot00 = xx * xx + xy * xy;
// X * Y
double dot01 = xx * yx + xy * yy;
// X * P
double dot02 = xx * px + xy * py;
// Y * Y
double dot11 = yx * yx + yy * yy;
// Y * P
double dot12 = yx * px + yy * py;
// calculate barycentric coordinates
double denom = (dot00 * dot11 - dot01 * dot01);
double num_u = (dot11 * dot02 - dot01 * dot12);
double num_v = (dot00 * dot12 - dot01 * dot02);
// u, v must not be constant
double u = num_u / denom;
double v = num_v / denom;
int inside = 0, f = 1;
// case A - point escapes edge XY
if (u + v > 1) {
f = -1;
if (u > v) {
u = u > 1 ? 1 : u;
v = 1 - u;
} else {
v = v > 1 ? 1 : v;
u = 1 - v;
}
} else // case B - point escapes either edge OX or OY
if ((u < 0) || (v < 0)) {
u = u < 0 ? 0 : u > 1 ? 1 : u;
v = v < 0 ? 0 : v > 1 ? 1 : v;
} else
// case C - point is in triangle
inside = 1;
// handle outside points
if (zero_edges == 1 && inside == 0)
u = v = 0;
else if (inside != 0) {
u = (u + pContext.random() * A * f);
v = (v + pContext.random() * A * f);
u = u < -1 ? -1 : u > 1 ? 1 : u;
v = v < -1 ? -1 : v > 1 ? 1 : v;
if ((u + v > 1) && (A > 0))
if (u > v) {
u = u > 1 ? 1 : u;
v = 1 - u;
} else {
v = v > 1 ? 1 : v;
u = 1 - v;
}
}
// set output
pVarTP.x += pAmount * (ox + u * xx + v * yx);
pVarTP.y += pAmount * (oy + u * xy + v * yy);
if (pContext.isPreserveZCoordinate()) {
pVarTP.z += pAmount * pAffineTP.z;
}
pVarTP.color = fmod(fabs(u + v), 1.0);
}
Aggregations