Sha256: db088fc5fb4741b30302f0c095b44ff9158bb50a83bb24b33a67280a2567b64c

Contents?: true

Size: 739 Bytes

Versions: 11

Compression:

Stored size: 739 Bytes

Contents

# The Nature of Code
# <http://www.shiffman.net/teaching/nature>
# Spring 2010
# Toxiclibs example: http://toxiclibs.org/

# Force directed graph
# Heavily based on: http://code.google.com/p/fidgen/

# Notice how we are using inheritance here!
# We could have just stored a reference to a VerletParticle object
# inside the Node class, but inheritance is a nice alternative
class Node < Physics::VerletParticle2D
  extend Forwardable
  def_delegators(:@app, :fill, :stroke, :stroke_weight, :ellipse)
  def initialize(pos)
    super(pos)
    @app = $app
  end

  # All we're doing really is adding a :display function to a VerletParticle
  def display
    fill(0, 150)
    stroke(0)
    stroke_weight(2)
    ellipse(x, y, 16, 16)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
toxiclibs-2.1.0 examples/simple_cluster/node.rb
toxiclibs-2.0.0 examples/simple_cluster/node.rb
toxiclibs-1.0.0 examples/simple_cluster/node.rb
toxiclibs-0.9.3 examples/simple_cluster/node.rb
toxiclibs-0.9.2 examples/simple_cluster/node.rb
toxiclibs-0.9.1 examples/simple_cluster/node.rb
toxiclibs-0.9.0 examples/simple_cluster/node.rb
toxiclibs-0.8.0 examples/simple_cluster/node.rb
toxiclibs-0.6.0-java examples/simple_cluster/node.rb
toxiclibs-0.5.1-java examples/simple_cluster/node.rb
toxiclibs-0.5.0-java examples/simple_cluster/node.rb