Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Last active December 31, 2015 20:49
Show Gist options
  • Select an option

  • Save practicingruby/8043103 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/8043103 to your computer and use it in GitHub Desktop.
def ellipse(point, r1, r2 = r1)
x, y = point
l1 = r1 * KAPPA
l2 = r2 * KAPPA
create_path do |path|
path.move(x + r1, y)
.curve(x, y + r2, x + r1, y + l2, x + l1, y + r2)
.curve(x - r1, y, x - l1, y + r2, x - r1, y + l2)
.curve(x, y - r2, x - r1, y - l2, x - l1, y - r2)
.curve(x +r1, y, x + l1, y - r2, x + r1, y - l2)
.move(x,y)
end
end
def create_path
yield PDF::Core::Path.new(current_page)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment