//Copyright 2005 Sean McCullough //banksean at yahoo public class ForcedNode extends Node { Vector3D f = new Vector3D(0,0,0); float mass = 1; String altLabel = ""; public ForcedNode(Vector3D v) { super(v); h = 10; w = 10; } public float getMass() { return mass; } public void setMass(float m) { mass = m; h = m*30; w = m*30; } public void setForce(Vector3D v) { f = v; } public Vector3D getForce() { return f; } public void applyForce(Vector3D v) { f = f.add(v); } public void setAltLabel(String al) { altLabel = al; } public void draw() { //super.draw(); if (g.getSelectedNode() == this) { stroke(32,64,255,128); strokeWeight(10); fill(255,255,255,128); } else if (g.getHoverNode() == this) { noStroke(); fill(255,255,255,128); } else { noStroke(); fill(255,255,255,64); } ellipse(getX(), getY(), h, w); fill(255,255,255,64); noStroke(); ellipse(getX(), getY(), 12, 12); fill(255); text(label, getX(), getY()); if (g.getHoverNode() == this || g.getSelectedNode() == this) { fill(64,255,64); text(altLabel, getX(), getY()+15); } smooth(); } }