class Node

Attributes

dims[RW]
fixed[RW]
id[RW]
pos[RW]
radius[RW]
speed[RW]

Public Class Methods

new(params={}) click to toggle source
# File lib/rtl/graph.rb, line 6
def initialize params={}
  puts "creating node #{params}"
  @id    =params["id"]
  @radius=params["radius"] || rand(5..10)
  @pos   =Vector.new *params["pos"]
  @speed =Vector.new *(params["speed"] || [0,0])
  @fixed =Vector.new *(params["fixed"] || [false,false])
  @dims  =Vector.new *(params["dims"]  || [10,5])
end

Public Instance Methods

print_info() click to toggle source
x() click to toggle source
# File lib/rtl/graph.rb, line 24
def x
  @pos.first
end
x=(v) click to toggle source
# File lib/rtl/graph.rb, line 16
def x=(v)
  @pos[0]=v
end
y() click to toggle source
# File lib/rtl/graph.rb, line 28
def y
  @pos.last
end
y=(v) click to toggle source
# File lib/rtl/graph.rb, line 20
def y=(v)
  @pos[1]=v
end