New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shape code sample in Shoes Manual is not working #43

Closed
BackOrder opened this Issue Jan 25, 2015 · 3 comments

Comments

Projects
None yet
1 participant
@BackOrder
Collaborator

BackOrder commented Jan 25, 2015

The Shoes Manual code sample for shape(left, top) { ... } in _Slots > Art_ section is not working. Shoes Console is reporting that the constant PI is not initialized.

Error in <unknown> line 0 | 2015-01-25 13:20:02 -0500
uninitialized constant PI
<main>:4:in `block (2 levels) in <main>'
<main>:2:in `call'
<main>:2:in `shape'
<main>:2:in `block in <main>'
eval:1:in `instance_eval'
eval:1:in `block in <main>'
<main>:in `call'
<main>:in `app'
<main>:in `<main>'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:215:in `eval'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:215:in `run_code'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:64:in `block (4 levels) in dewikify_code'
-e:1:in `call'
@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Jan 25, 2015

Collaborator

The following code seems to fix the issue but no sample of the shape were provided before hand in order to ascertain its validity. The rendering is depicted below.

image

 Shoes.app do
   fill red(0.2)
   shape do
     move_to(90, 55)
     arc_to(50, 55, 50, 50, 0, Math::PI / 2)
     arc_to(50, 55, 60, 60, Math::PI / 2, Math::PI)
     arc_to(50, 55, 70, 70, Math::PI, 2 * Math::PI - Math::PI / 2)
     arc_to(50, 55, 80, 80, Math::PI, 2 * Math::PI)
   end
 end
Collaborator

BackOrder commented Jan 25, 2015

The following code seems to fix the issue but no sample of the shape were provided before hand in order to ascertain its validity. The rendering is depicted below.

image

 Shoes.app do
   fill red(0.2)
   shape do
     move_to(90, 55)
     arc_to(50, 55, 50, 50, 0, Math::PI / 2)
     arc_to(50, 55, 60, 60, Math::PI / 2, Math::PI)
     arc_to(50, 55, 70, 70, Math::PI, 2 * Math::PI - Math::PI / 2)
     arc_to(50, 55, 80, 80, Math::PI, 2 * Math::PI)
   end
 end
@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Jan 25, 2015

Collaborator

PI definitions can be found in https://github.com/Shoes3/shoes3/blob/master/shoes/ruby.c. They are unfortunately unavailable at runtime as PI, TWO_PI, etc, but Shoes::PI does work.

  rb_const_set(cTypes, rb_intern("RAD2PI"), rb_float_new(SHOES_RAD2PI));
  rb_const_set(cTypes, rb_intern("TWO_PI"), rb_float_new(SHOES_PIM2));
  rb_const_set(cTypes, rb_intern("HALF_PI"), rb_float_new(SHOES_HALFPI));
  rb_const_set(cTypes, rb_intern("PI"), rb_float_new(SHOES_PI));
Collaborator

BackOrder commented Jan 25, 2015

PI definitions can be found in https://github.com/Shoes3/shoes3/blob/master/shoes/ruby.c. They are unfortunately unavailable at runtime as PI, TWO_PI, etc, but Shoes::PI does work.

  rb_const_set(cTypes, rb_intern("RAD2PI"), rb_float_new(SHOES_RAD2PI));
  rb_const_set(cTypes, rb_intern("TWO_PI"), rb_float_new(SHOES_PIM2));
  rb_const_set(cTypes, rb_intern("HALF_PI"), rb_float_new(SHOES_HALFPI));
  rb_const_set(cTypes, rb_intern("PI"), rb_float_new(SHOES_PI));
@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Jan 26, 2015

Collaborator

The manual needs to be updated with the code below. The proper rendering looks like this:

image

 Shoes.app do
   fill red(0.2)
   shape do
     move_to(90, 55)
     arc_to(50, 55, 50, 50, 0, Shoes::PI/2)
     arc_to(50, 55, 60, 60, Shoes::PI/2, Shoes::PI)
     arc_to(50, 55, 70, 70, Shoes::PI, Shoes::TWO_PI-Shoes::PI/2)
     arc_to(50, 55, 80, 80, Shoes::TWO_PI-Shoes::PI/2, Shoes::TWO_PI)
   end
 end
Collaborator

BackOrder commented Jan 26, 2015

The manual needs to be updated with the code below. The proper rendering looks like this:

image

 Shoes.app do
   fill red(0.2)
   shape do
     move_to(90, 55)
     arc_to(50, 55, 50, 50, 0, Shoes::PI/2)
     arc_to(50, 55, 60, 60, Shoes::PI/2, Shoes::PI)
     arc_to(50, 55, 70, 70, Shoes::PI, Shoes::TWO_PI-Shoes::PI/2)
     arc_to(50, 55, 80, 80, Shoes::TWO_PI-Shoes::PI/2, Shoes::TWO_PI)
   end
 end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment