Sha256: 4b949cbb242c50cea49d9cc1e80ad979852e3e9c0a50146d3f5914f51077f42a
Contents?: true
Size: 734 Bytes
Versions: 2
Compression:
Stored size: 734 Bytes
Contents
require 'forwardable' # The Nature of Code # Daniel Shiffman # http://natureofcode.com # 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 = Processing.app end # All we're doing really is adding a display function to a VerletParticle def display fill(50, 200, 200, 150) stroke(50, 200, 200) stroke_weight(2) ellipse(x, y, 16, 16) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
toxiclibs-2.1.0 | examples/force_directed/node.rb |
toxiclibs-2.0.0 | examples/force_directed/node.rb |