Sha256: f7a4baf1bddb5f510d2ac30537af10f0b4b1f764cdad6becb079f9f2951be7dc
Contents?: true
Size: 885 Bytes
Versions: 1
Compression:
Stored size: 885 Bytes
Contents
#!/usr/bin/env ruby # encoding: utf-8 require 'gss' require 'optparse' require 'csv' options = {} opts = OptionParser.new opts.banner = "Generate points with uniform distribution on the sphere." opts.on("-c", "--cartesian", "Cartesian coordinate."){|v| options[:cartesian] = true } opts.on("-r", "--relocate", "Relocate first and last point."){|v| options[:relocation] = true } opts.on_tail("-h", "--help", "Show this message."){|v| print opts.help exit } opts.on_tail("-v", "--version", "Show version."){|v| puts "v#{GSS::VERSION}" exit } opts.parse! r = ARGV.shift.to_f n = ARGV.shift.to_i gss = GSS::Generator.new points = gss.generate(n, options[:relocation]) points.each do |p| if options[:cartesian] coord = p.to_cartesian.map{|c| c * r } print coord.to_csv else print [r, p.theta, p.phi].to_csv end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gss_generator-0.2.0 | exe/gss_gen |