BiG problem with RevRotatePoly

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
fm31
Posts: 22
Joined: Tue Apr 23, 2013 2:08 pm

BiG problem with RevRotatePoly

Post by fm31 » Tue Jul 28, 2015 9:17 pm

Hello

I have a big problem with RevRotatePoly function in 7.0.6 version . I looked for information in this forum but nothing about the real same problem.

my problem is the next :

I have a graphic polygone reference.
with my program, I can clone this graphic and then, the user can move or resize or rotate this new one graphic.

the problem came from the use of the RevrotatePoly function. for example, if a create a new graphic , and then I move it and rotate it (by code by calculate new lists points)) there is no Pb and the dimensions of the graphic continue to be the same as the original

now, if I resize it by code by calculate the points , then, if I rotate it again, then, the new dimensions are remplaced by the previous after rotate....(the dim of the original graphic who was used to be clone) :x

I don't understand why ? before the rotate instruction , it s good and just after , not

I have made some tests and there is a reality that the dimensions are reseted at each time

I saw some topics about "lock loc" but no effect

I saw the code of the RevRotatePoly and I saw the using of "realpoints" . I dont understand what is theses points because theses realpoints have strange values (4567.677,2455,009 ..... for example) but that I had seen, the points of the graphic are updated with these realpoints values that is very strange because there are no integers values

I saw the use of effective points but I dont understand what are they ?

If someone can explain to me what happens

thanks for your help

François

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: BiG problem with RevRotatePoly

Post by mwieder » Wed Jul 29, 2015 12:14 am

François-

Can you post some code that isn't working?

The details of the code underneath is a bit involved... the "effective" points are used for speed, because it isn't necessary to actually set points when they're only used during the calculations. The "real" points are because the engine only allows for integer points to be assigned when mapping pixels to the screen, and saving the actual real number values allows multiple rotations to happen without deformations due to rounding errors.

But at any rate, rotating a graphic should work, so post a sample of non-working code and let's see what's going on.

fm31
Posts: 22
Joined: Tue Apr 23, 2013 2:08 pm

Re: BiG problem with RevRotatePoly

Post by fm31 » Wed Jul 29, 2015 12:13 pm

hello

To illustrate the problem, here is a small stack "essai_RevRotateLib.zip" in attachment where you can see the problem. follow instruction and if someone understand where the problem is , I agree to get the solution

thanks

François
Attachments
essai_RevRotateLib.7z
(2.04 KiB) Downloaded 223 times

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: BiG problem with RevRotatePoly

Post by mwieder » Thu Jul 30, 2015 9:48 pm

Ah, I see what's going on here...

Try resizing and then rotating *without* first doing a rotation. Then it works fine.
You've found an edge case (aka bug) here.
The setting the points action really should reset an initial state for the polygon.
Since it's not, the original rotation already set the realpoints, and there's a check to see if they've been set already (for speed) so they are reused instead of recalculated for the resized points.

I'll file a bug report on this.

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: BiG problem with RevRotatePoly

Post by MaxV » Fri Jul 31, 2015 3:50 pm

Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

golive
Posts: 98
Joined: Wed Jul 01, 2015 5:16 am

Re: BiG problem with RevRotatePoly

Post by golive » Sat Aug 01, 2015 1:36 am

I love your blog!
Very useful Livecode info, and updated often
I use the automatic Google translation to read it in English.

Thanks, and keep up the good work :D

fm31
Posts: 22
Joined: Tue Apr 23, 2013 2:08 pm

Re: BiG problem with RevRotatePoly

Post by fm31 » Mon Aug 03, 2015 2:17 pm

Mwieder, thanks for the time you have used to see my problem

MaxV, I'll go to see your livecode blog

Pour the end, I build my own rotate function and its OK

thanks to all and I hope the bug will be corrected

Fm31

Post Reply