/* Adapted to my needs by Robert Twomey Graph Layout using traer.physics http://www.cs.princeton.edu/~traer/physics Sean McCullough http://www.cricketschirping.com 26. Feb 2007 */ import traer.physics.*; import traer.animation.*; public class Node { Particle p; String label = ""; String id; int w = 20; int h = 20; color c = color(0); boolean isSelected = false; boolean isHovering = false; boolean isDragging = false; Graph g; float lastTouch = 0; public Node(Particle p, Graph g, String id) { this.p = p; this.g = g; this.id = id; } public String getId() { return id; } public void setPosition(float x, float y, float z) { p.moveTo(x, y, z); } public boolean containsPoint(float x, float y) { float dx = p.position().x()-x; float dy = p.position().y()-y; return (abs(dx) < w*centroid.z()/2.0 && abs(dy)