revRotatePoly
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
revRotatePoly
Hi, can someone please help me?, I'm having a problem with revRotatePoly.
Every time I use it to preview a recently modified graphic object, a polygon I created earlier on that same object shows up. Can anyone help me figure out why this is happening? Thanks a lot.
Every time I use it to preview a recently modified graphic object, a polygon I created earlier on that same object shows up. Can anyone help me figure out why this is happening? Thanks a lot.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: revRotatePoly
I am not quite sure what you mean.
This seems to work alright:
- -
Apart from the distinctly non-intuitive:
which would be far, far better were it [pseudo]
everything seems to work with no obvious problems.
But, then, I don't understand what you mean by this:
This seems to work alright:
- -
Apart from the distinctly non-intuitive:
Code: Select all
revRotatePoly the name of grc "P5", 20
Code: Select all
revRotatePoly grc "P5", 20
But, then, I don't understand what you mean by this:
a polygon I created earlier on that same object shows up
Re: revRotatePoly
Thanks Richmond. In my case, adapting to your example, it would be something like this:
Let's say I modify the points of that graphic 'p5' so that instead of a pentagon it draws a square, for example. Okay, I would see the square then. However, as soon as I execute the same code again:
revRotatePoly the name of grc 'p5', 20
The square disappears and the pentagon reappears !!!
It's true that I'm not working with regular polygons, but rather transforming geographic coordinates from Google Earth, but I'm not sure why this is happening. It's very likely that it's some silly mistake on my part, but I've been at it for a while and can't figure out the problem
Let's say I modify the points of that graphic 'p5' so that instead of a pentagon it draws a square, for example. Okay, I would see the square then. However, as soon as I execute the same code again:
revRotatePoly the name of grc 'p5', 20
The square disappears and the pentagon reappears !!!
It's true that I'm not working with regular polygons, but rather transforming geographic coordinates from Google Earth, but I'm not sure why this is happening. It's very likely that it's some silly mistake on my part, but I've been at it for a while and can't figure out the problem
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: revRotatePoly
INDEED . . .
just the same "over here".
- Attachments
-
- ROLY_POLY 2.livecode.zip
- Stack.
- (1.28 KiB) Downloaded 56 times
Re: revRotatePoly
"Power to the squares!!!
... Anyway, nothing to do about it. Let's see if I can figure out the solution.
... Anyway, nothing to do about it. Let's see if I can figure out the solution.
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: revRotatePoly
Hi Fermin,
What happens is that revRotatePoly creates a custom property of the polygon the first time it is invoked.
The reason is that the points of the polygon are integers and when rotating integers they "degrade" very quickly. To alleviate that the points of the polygon are saved to the custom property of the graphic "realPoints" as real numbers, i.e. like 123.54321.
If you now repeat revRotatePoly after having changed the points of the graphic Livecode looks first at the custom property and uses the real number to rotate the graphic again.
You can avoid that by doing after changing the points of your graphic
and then do a revRotatePoly. The polygon will then use the new points for rotation.
Kind regards
Bernd
What happens is that revRotatePoly creates a custom property of the polygon the first time it is invoked.
The reason is that the points of the polygon are integers and when rotating integers they "degrade" very quickly. To alleviate that the points of the polygon are saved to the custom property of the graphic "realPoints" as real numbers, i.e. like 123.54321.
If you now repeat revRotatePoly after having changed the points of the graphic Livecode looks first at the custom property and uses the real number to rotate the graphic again.
You can avoid that by doing after changing the points of your graphic
Code: Select all
set the realPoints of graphic "myGraphic" to empty
Kind regards
Bernd
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: revRotatePoly
I would just suppose this is where one has to get one's head
round effective points and real points . . . a bit like fake news.
round effective points and real points . . . a bit like fake news.
Re: revRotatePoly
Thank you, Richmond... and Thank you very much, Bernd!!! Understood, applied, and problem solved.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: revRotatePoly
He always has 'a march' on the rest of us.Thank you very much, Bernd!!!
- Attachments
-
- ROLY_POLY 3.livecode.zip
- Stack.
- (1.31 KiB) Downloaded 59 times
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: revRotatePoly
As far as march is concerned:richmond62 wrote: ↑Fri Apr 14, 2023 8:12 pmHe always has 'a march' on the rest of us.Thank you very much, Bernd!!!
My favorite radio ad from Pan Am was
Son, don't walk if you don't have to.
Kind regards
Bernd