Rotating Polygons

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
RobertC
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 46
Joined: Sun Feb 04, 2007 3:43 pm

Rotating Polygons

Post by RobertC » Mon Jul 21, 2008 2:26 pm

I needed to rotate polygons but found that polygons do not have an "angle" property like images have.
I wrote a few routines to do the job, they may come in handy.
See
http://www.robertcailliau.eu/Alphabetic ... ation.html

and I'll be happy with constructive comments.

Robert.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10055
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld » Mon Jul 21, 2008 6:00 pm

Nicely done.

For the future, this prompted me to submit a request to have the angle property honored for all graphics - you can add your vote here:
http://quality.runrev.com/qacenter/show_bug.cgi?id=6816
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Jul 21, 2008 7:18 pm

Hi,

I agree, an angle property for polygons would be nice. In the meantime on could come close to the functionality with revRotatePoly.

make an irregular polygon, name it "g1"
create a custom property for this graphic "g1" called myPoints
set myPoints to the points of graphic "g1"

create a slider, set the endvalue of this slider to 359

set the script of the slider to:

on scrollbarDrag newValue
lock screen
set the points of graphic "g1" to the myPoints of graphic "g1"
revRotatePoly the name of graphic "g1", newValue
end scrollbarDrag

well it rotates, not bad...

Robert, thank you for the explanations on your website, it helps my 'mathematically challenged mind' a lot :-)

regards

Bernd

Post Reply