apply(pLayer, 0.2);
apply(pLayer, 0.1);
}
private void apply(Layer pLayer, double pAmount) {
XForm xForm;
if (pLayer.getFinalXForms().size() == 0 || Math.random() < 0.5) {
xForm = pLayer.getXForms().get((int) (pLayer.getXForms().size() * Math.random()));
}
else {
xForm = pLayer.getFinalXForms().get((int) (pLayer.getFinalXForms().size() * Math.random()));
}
if (Math.random() < 0.5) {
if (Math.random() < 0.75) {
if (Math.random() < 0.5) {
xForm.setCoeff00(xForm.getCoeff00() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setCoeff01(xForm.getCoeff01() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setCoeff10(xForm.getCoeff10() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setCoeff11(xForm.getCoeff11() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setCoeff20(xForm.getCoeff20() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setCoeff21(xForm.getCoeff21() + pAmount * (-0.25 + 0.5 * Math.random()));
}
}
else {
if (Math.random() < 0.5) {
xForm.setPostCoeff00(xForm.getPostCoeff00() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setPostCoeff01(xForm.getPostCoeff01() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setPostCoeff10(xForm.getPostCoeff10() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setPostCoeff11(xForm.getPostCoeff11() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setPostCoeff20(xForm.getPostCoeff20() + pAmount * (-0.25 + 0.5 * Math.random()));
}
if (Math.random() < 0.5) {
xForm.setPostCoeff21(xForm.getPostCoeff21() + pAmount * (-0.25 + 0.5 * Math.random()));
}
}
}
else {
if (Math.random() < 0.33) {