Book a Demo

Author Topic: v16β - Rotation angle in polygon() does it still work?  (Read 4490 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
v16β - Rotation angle in polygon() does it still work?
« on: February 14, 2022, 05:43:19 pm »
The Shapescript help says:
polygon(int centerx,int centery, int numberofsides, int radius, float rotation)
Draws a regular polygon with center at the point (centerx, centery), and numberofsides number of sides.

In the past, I believe we used the rotation angle in some of our shape scripts.  You will note that the definition does not contain an entry for rotation.
We tried to set up a rotated square as:
      polygon(50,60,4,20,45.0);
but the shapescript delivers an unrotated square of the correct dimensions.

Has anybody recently used the rotation angle?  Is there a "secret sauce"?

TIA & Reported,
Paolo
« Last Edit: February 14, 2022, 06:21:29 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: v16β - Rotation angle in polygon() does it still work?
« Reply #1 on: February 16, 2022, 04:26:09 pm »
Looks like my bad!  It turns out that in order to draw a rotated rectangle, you need to see the rotation angle to zero!  Who knew?   If you select 45 degrees, you get what to me looks like an unrotated rectangle.  That is, its sides are aligned with the page.

There probably should be some comment in the notes to indicate how the polygon is drawn

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: v16β - Rotation angle in polygon() does it still work?
« Reply #2 on: February 17, 2022, 08:27:48 am »
It appears that with rotation angle set to 0, the first point is drawn in the middle of the right edge. Not sure why, but it's probably done that way by the 3rd party graphics library.
The Sparx Team
[email protected]