Skip to content

Instantly share code, notes, and snippets.

@obelisk68
Created February 5, 2018 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obelisk68/2bf5391d337ea0cc1c5e3ee7e44a1456 to your computer and use it in GitHub Desktop.
Save obelisk68/2bf5391d337ea0cc1c5e3ee7e44a1456 to your computer and use it in GitHub Desktop.
C曲線
require 'oekaki'
require_relative 'turtle'
Width, Height = 600, 400
Oekaki.app width: Width, height: Height, title: "C curve" do
draw do
clear
t = Turtle.new(Width, Height, self)
t.move(-130, -100)
t.color(0, 65535, 0)
ratio = sqrt(2) / 2
drawing = lambda do |length, depth|
if depth.zero?
t.forward(length)
else
t.left(45)
drawing[length * ratio, depth - 1]
t.right(90)
drawing[length * ratio, depth - 1]
t.left(45)
end
end
drawing[260.0, 10]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment