Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running the example code #4

Open
ragesoss opened this issue Mar 20, 2019 · 0 comments
Open

Error running the example code #4

ragesoss opened this issue Mar 20, 2019 · 0 comments

Comments

@ragesoss
Copy link

I tried running the example code from the README, but I'm stuck with an unexpected error. I'm running this on Debian 9, with Ruby 2.6.1.

I tried this code:

# maptest.rb
require 'ruby_vor'

points = [
  RubyVor::Point.new(120, 290),
  RubyVor::Point.new(110, 120),
  RubyVor::Point.new(160, 90.2),
  RubyVor::Point.new(3.14159265, 3.14159265)
]

# Compute the diagram & triangulation
comp = RubyVor::VDDT::Computation.from_points(points)

puts "The nearest-neighbor graph:"
pp comp.nn_graph

puts "\nThe minimum-spanning tree:"
pp comp.minimum_spanning_tree

# Just the triangulation
RubyVor::Visualizer.make_svg(comp, :name => 'tri.svg')

# Just the MST
RubyVor::Visualizer.make_svg(comp, :name => 'mst.svg', :triangulation => false, :mst => true)

# Voronoi diagram and the triangulation
RubyVor::Visualizer.make_svg(comp, :name => 'dia.svg', :voronoi_diagram => true)

It results in this output:

The nearest-neighbor graph:
[[2, 1, 3], [3, 2, 0], [3, 1, 0], [1, 2, 0]]

The minimum-spanning tree:
Traceback (most recent call last):
        3: from maptest.rb:17:in `<main>'
        2: from maptest.rb:17:in `minimum_spanning_tree'
        1: from /home/sage/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubyvor-0.1.4/lib/ruby_vor/priority_queue.rb:60:in `push'
/home/sage/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubyvor-0.1.4/lib/ruby_vor/priority_queue.rb:60:in `percolate_up': no implicit conversion to float from nil (TypeError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant