Commit b852e8ec authored by Vesa-Pekka Palmu's avatar Vesa-Pekka Palmu

Fix the math for circle generation

parent 578237e6
#!/bin/env ruby
#!/usr/bin/env ruby
origin = [176/2, 176/2]
r = 500 * 176 / 1080
origin = [192/2, 192/2]
r = 500 * 192 / 1080
points = []
n = 60
(1..n).each do |i|
x = origin[0] + (r * Math.sin((i*2*Math::PI + 1.5) / n))
x = origin[0] + (r * Math.sin((i*2*Math::PI) / n))
y = origin[1] + (r * Math.cos((i*2*Math::PI) / n))
points << [x.floor, y.floor]
points << [x.round, y.round]
end
puts "circles := [#{n}][2]int16 {"
points.reverse.each do |p|
points.reverse!
points[30..59].each do |p|
puts "{#{p[0]}, #{p[1]}},"
end
points[0..29].each do |p|
puts "{#{p[0]}, #{p[1]}},"
end
puts "}"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment