fork(1) download
  1. r=30
  2. v=12
  3. a=[30,90,150,210,270,330]
  4. d=Math::PI/180
  5. xy=a.map{|e|[r*Math.cos(e*d),r*Math.sin(e*d)]}
  6. dv=proc{|xy1,xy2,m|
  7. [((v-m)*xy1[0]+m*xy2[0])/v,
  8. ((v-m)*xy1[1]+m*xy2[1])/v]
  9. }
  10. pt=[]
  11. (0..v).each{|m|
  12. pt<<dv.(xy[0],xy[2],m)
  13. pt<<dv.(xy[2],xy[4],m)
  14. pt<<dv.(xy[4],xy[0],m)
  15. pt<<dv.(xy[1],xy[3],m)
  16. pt<<dv.(xy[3],xy[5],m)
  17. pt<<dv.(xy[5],xy[1],m)
  18. }
  19. pt.each do |e|
  20. p e.map { |coord| coord.round(3) }
  21. end
Success #stdin #stdout 0.01s 7996KB
stdin
Standard input is empty
stdout
[25.981, 15.0]
[-25.981, 15.0]
[0.0, -30.0]
[0.0, 30.0]
[-25.981, -15.0]
[25.981, -15.0]
[21.651, 15.0]
[-23.816, 11.25]
[2.165, -26.25]
[-2.165, 26.25]
[-21.651, -15.0]
[23.816, -11.25]
[17.321, 15.0]
[-21.651, 7.5]
[4.33, -22.5]
[-4.33, 22.5]
[-17.321, -15.0]
[21.651, -7.5]
[12.99, 15.0]
[-19.486, 3.75]
[6.495, -18.75]
[-6.495, 18.75]
[-12.99, -15.0]
[19.486, -3.75]
[8.66, 15.0]
[-17.321, 0.0]
[8.66, -15.0]
[-8.66, 15.0]
[-8.66, -15.0]
[17.321, 0.0]
[4.33, 15.0]
[-15.155, -3.75]
[10.825, -11.25]
[-10.825, 11.25]
[-4.33, -15.0]
[15.155, 3.75]
[0.0, 15.0]
[-12.99, -7.5]
[12.99, -7.5]
[-12.99, 7.5]
[0.0, -15.0]
[12.99, 7.5]
[-4.33, 15.0]
[-10.825, -11.25]
[15.155, -3.75]
[-15.155, 3.75]
[4.33, -15.0]
[10.825, 11.25]
[-8.66, 15.0]
[-8.66, -15.0]
[17.321, 0.0]
[-17.321, 0.0]
[8.66, -15.0]
[8.66, 15.0]
[-12.99, 15.0]
[-6.495, -18.75]
[19.486, 3.75]
[-19.486, -3.75]
[12.99, -15.0]
[6.495, 18.75]
[-17.321, 15.0]
[-4.33, -22.5]
[21.651, 7.5]
[-21.651, -7.5]
[17.321, -15.0]
[4.33, 22.5]
[-21.651, 15.0]
[-2.165, -26.25]
[23.816, 11.25]
[-23.816, -11.25]
[21.651, -15.0]
[2.165, 26.25]
[-25.981, 15.0]
[0.0, -30.0]
[25.981, 15.0]
[-25.981, -15.0]
[25.981, -15.0]
[0.0, 30.0]