package net.beadsproject.touch.examples;
import java.util.List;

import net.beadsproject.touch.HVLayout;
import net.beadsproject.touch.perform.PerformNode;
import processing.core.PApplet;

/**
 * Demonstrates the use of HVLayout.
 * 
 * @author ben
 *
 */
public class HVLayoutTest extends PApplet {	
	
	static final int DEPTH = 5;
	static final int NARY = 3;
	static int NUM_PARTICLES = 1;
	
	static PerformNode pt = null;
	List<HVLayout.HVPoint> points = null;
	
	public void setup()
	{		
		size(900,900);
		ellipseMode(CENTER);
		
		println("Building tree");
		pt = Example.example1();
		pt.computeUniqueValue(0, 1);
		
		println("Laying out");
		points = HVLayout.layout(pt);
		
		println("Done");
	}	
		
	public void draw()
	{		
		background(255);
		pushMatrix();
		scale(width,height);
		for(HVLayout.HVPoint p: points)
		{
			p.pDraw(this);
			
			fill(0);
			noStroke();
			ellipse((float)p.x,(float)p.y,4.f/width,4.f/height);
		}
		popMatrix();
	}		
}
