jwildfire.org

The official JWildfire forum
It is currently Thu Sep 19, 2019 1:24 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
 Post subject: ThreeQuarterMirror
PostPosted: Sun Aug 16, 2015 5:51 am 
Offline
User avatar

Joined: Mon Jun 03, 2013 7:44 am
Posts: 211
Created and tested this new idea today.
This is for custom_wf, though there aren't any variables beyond pAmount, so it should be easy enough to add to JWF if you like.
The basic idea is to work with all of the pixels within a box whose width and height are both pAmount*2. The pixels in a square region in the upper left corner of the screen are moved to the lower right corner of the screen. Everything else in the working region is flipped over the y=x axis.
Code:
// For custom_wf
// Created by Nic Anderson (chronologicaldot), August 15, 2015

import org.jwildfire.create.tina.base.XForm;
import org.jwildfire.create.tina.variation.FlameTransformationContext;
import org.jwildfire.create.tina.base.XYZPoint;
import static org.jwildfire.base.mathlib.MathLib.*;

  public void init(FlameTransformationContext pContext, XForm pXForm) {

  }

  public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {

// Shift a box, whose width and height are pAmount, from the upper left of the graph to the lower right.
// Then flip everything else over the y=x axis.

double x = pAffineTP.x;
double y = pAffineTP.y;

if ( pAmount + x < 0 || pAmount + y < 0 ) // too far
{
   pVarTP.x += x;
   pVarTP.y += y;
   return;
}

if ( x < 0 && y < 0 )
{
    pVarTP.x += x+pAmount;
    pVarTP.y += y+pAmount;
} else {
    if ( x < pAmount && y < pAmount && x + pAmount > 0 && y + pAmount > 0 )
    {
       pVarTP.x -= y;
       pVarTP.y -= x;
    }
    else
    {
         pVarTP.x += x;
         pVarTP.y += y;
    }
}

  }

_________________
Fractal artwork: http://ablipintime.deviantart.com


Top
   
 Post subject: Re: ThreeQuarterMirror
PostPosted: Sun Aug 16, 2015 2:32 pm 
Offline
User avatar

Joined: Sun May 31, 2015 2:39 pm
Posts: 604
looks really cool :) Image


Top
   
 Post subject: Re: ThreeQuarterMirror
PostPosted: Sun Aug 16, 2015 8:38 pm 
Offline
User avatar

Joined: Mon Jun 03, 2013 7:44 am
Posts: 211
Thanks! :)
I hope you have fun with it!

_________________
Fractal artwork: http://ablipintime.deviantart.com


Top
   
 Post subject: Re: ThreeQuarterMirror
PostPosted: Sun Aug 16, 2015 11:00 pm 
Offline
User avatar

Joined: Sun May 31, 2015 2:39 pm
Posts: 604
http://snicker02.deviantart.com/art/str ... -554190430


Top
   
 Post subject: Re: ThreeQuarterMirror
PostPosted: Sun Aug 16, 2015 11:48 pm 
Offline
User avatar

Joined: Thu May 16, 2013 1:05 am
Posts: 487
Location: Vancouver,BC Canada
Thanks for this new variation!


Top
   
 Post subject: Re: ThreeQuarterMirror
PostPosted: Mon Aug 17, 2015 1:10 am 
Offline
User avatar

Joined: Sun May 31, 2015 2:39 pm
Posts: 604
http://snicker02.deviantart.com/art/150 ... -554202455


Top
   
 Post subject: Re: ThreeQuarterMirror
PostPosted: Sat Feb 09, 2019 3:34 pm 
Offline
User avatar

Joined: Sun May 31, 2015 2:39 pm
Posts: 604
Decided to add some variables to this one and also added another "type" that does some fun things. Also changed the name to tqmirror.
Code:
/*
  JWildfire - an image and animation processor written in Java 
  Copyright (C) 1995-2011 Andreas Maschke
  This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
  General Public License as published by the Free Software Foundation; either version 2.1 of the 
  License, or (at your option) any later version.
 
  This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
  Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public License along with this software; 
  if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jwildfire.create.tina.variation;


import org.jwildfire.create.tina.base.XForm;
import org.jwildfire.create.tina.base.XYZPoint;

public class TQMirrorFunc extends VariationFunc {
	private static final long serialVersionUID = 1L;

	private static final String PARAM_A = "a";
	private static final String PARAM_B = "b";
	private static final String PARAM_C = "c";
	private static final String PARAM_D = "d";
	private static final String PARAM_E = "e";
	private static final String PARAM_F = "f";
	private static final String PARAM_G = "g";
	private static final String PARAM_H = "h";
	private static final String PARAM_TYPE = "type";

	private static final String[] paramNames = { PARAM_A, PARAM_B, PARAM_C, PARAM_D, PARAM_E, PARAM_F, PARAM_G, PARAM_H,
			PARAM_TYPE };
	private double a = 1.0;
	private double b = 1.0;
	private double c = 1.0;
	private double d = 1.0;
	private double e = 1.0;
	private double f = 1.0;
	private double g = 1.0;
	private double h = 1.0;
	private int type = 0;

	@Override
	public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP,
			double pAmount) {
		// Shift a box, whose width and height are pAmount, from the upper left of the
		// graph to the lower right.
		// Then flip everything else over the y=x axis.

		double x = pAffineTP.x;
		double y = pAffineTP.y;

		if (d + x < 0 || e + y < 0) // too far
		{
			if (type != 0) {
				pVarTP.x += x;
				pVarTP.y += y;
			} else {
				pVarTP.x += y;
				pVarTP.y += x;
			}
			return;
		}

		if (x < 0 && y < 0) {
			pVarTP.x += x + pAmount * f;
			pVarTP.y += y + pAmount * g;

		} else {
			if (x < pAmount && y < a && x + b > 0 && y + c > 0) {
				pVarTP.x -= y * h;
				pVarTP.y -= x * h;
			} else {
				pVarTP.x += x;
				pVarTP.y += y;
			}
		}
			if (pContext.isPreserveZCoordinate()) {
		pVarTP.z += pAmount * pAffineTP.z;
	}

	}

	@Override
	public String[] getParameterNames() {
		return paramNames;
	}

	@Override
	public Object[] getParameterValues() {
		return new Object[] { a, b, c, d, e, f, g, h, type };
	}

	@Override
	public void setParameter(String pName, double pValue) {
		if (PARAM_A.equalsIgnoreCase(pName)) {
			a = pValue;
		} else if (PARAM_B.equalsIgnoreCase(pName)) {
			b = pValue;
		} else if (PARAM_C.equalsIgnoreCase(pName)) {
			c = pValue;
		} else if (PARAM_D.equalsIgnoreCase(pName)) {
			d = pValue;
		} else if (PARAM_E.equalsIgnoreCase(pName)) {
			e = pValue;
		} else if (PARAM_F.equalsIgnoreCase(pName)) {
			f = pValue;
		} else if (PARAM_G.equalsIgnoreCase(pName)) {
			g = pValue;
		} else if (PARAM_H.equalsIgnoreCase(pName)) {
			h = pValue;
		} else if (PARAM_TYPE.equalsIgnoreCase(pName)) {
			type = (int) limitVal(pValue, 0, 1);
		} else {
			System.out.println("pName not recognized: " + pName);
			throw new IllegalArgumentException(pName);
		}
	}

	@Override
	public String getName() {
		return "tqmirror";
	}


}


Top
   
 Post subject: Re: ThreeQuarterMirror
PostPosted: Mon Feb 11, 2019 9:52 pm 
Offline
User avatar

Joined: Mon Jun 03, 2013 7:44 am
Posts: 211
I hadn't toyed with JWF in a long time.
Brad, I love it! All kinds of neat patterns you can make with it using only the first three variables! Glad you're still having fun with this stuff! :D

_________________
Fractal artwork: http://ablipintime.deviantart.com


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited
Theme Created by HOLLYSMOKE
Theme updated to phpBB 3.1.6 by KamijouTouma
Theme Version is 3.1.6-ss2