Angles

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
nigelBUSrqT
Posts: 14
Joined: Fri May 11, 2012 6:24 am

Angles

Post by nigelBUSrqT » Fri Jun 01, 2012 9:35 am

Hello there - I've started out developing an adjustable pie graph in which an icon can be used to adjust the size of individual sectors by finger swipe - similar to the neat and elegant version reported by BvG in 2008 (my account does not yet enable me to provide the link).

I was initially struggling to extend that approach (my limited understanding of LiveCode - have just started) - so I set out to do it from scratch so I could follow the logic step by step without calls to other places that I was having difficulty tracing.

I've been using Animation Engine's constrainCircularCallBack and my first couple of sectors have shaped up well: moving the icon adjusts the arcangle of the sector beautifully. However, I am really puzzled by the difference in approach to characterising angles for the "findangle" function (used for the icon) and "startangle" and "arcangle" properties (used for the oval graphic that generates the sector of the pie). For findangle, angles are characterised from a vertical line and clockwise (i.e. 3 o'clock is at 90 degrees). For the "startangle" and "arc angle" properties, angles are characterised from a horizontal line and anticlockwise (12 o'clock is at 90 degrees). I've generated code that converts one approach into the other and adjusts for moving beyond 360 degrees but this difference in characterising the angles turns what should be a straightforward piece of work into something brain-frying as you try to extend the number of sectors.

Presumably, there are some standards that are being applied here that make this the only way this can be done. I am not a mathematician and have only recently come to programming - is anyone explain to me what they are so that I can submit myself to working out the remainder of segments with confidence that I have not missed something that could make this much less painful

:-)

Many thanks

Nigel

Klaus
Posts: 14197
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Angles

Post by Klaus » Fri Jun 01, 2012 11:15 am

Hi Nigel,

sorry, I was always weak in math so no help in this respect from my side,
but welcome to the forum :D

Please check these stacks to get the concepts of LiveCode:
http://www.runrev.com/developers/lesson ... nferences/


Best

Klaus

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

Re: Angles

Post by bn » Fri Jun 01, 2012 11:29 am

Hi Nigel,

I am at least as weak in math as Klaus and you. And my brain is completely "fried". (like that expression)

Here is a stack that converts the startAngle so it can be moved from 0 at 12 clockwise.
It uses a slider from 0 to 1000 to make the point. If I understand what your problem is then this should translate between the two ways to manipulate angles. The same would apply to the arcAngle.
turnClockwiseNigel.livecode.zip
(1.11 KiB) Downloaded 254 times
Kind regards
Bernd

nigelBUSrqT
Posts: 14
Joined: Fri May 11, 2012 6:24 am

Re: Angles

Post by nigelBUSrqT » Fri Jun 01, 2012 6:01 pm

Thanks, Both, for your helpful responses - I will dive into the Conferences and work with turnClockwise and let you know how things evolve over the next few days

very best

N

:D

nigelBUSrqT
Posts: 14
Joined: Fri May 11, 2012 6:24 am

Re: Angles

Post by nigelBUSrqT » Wed Jun 06, 2012 7:18 am

A quick update: have realized that most of my challenge remains in:

1 - having so many components in the pie - this may become more manageable when I have gained more expertise in managing arrays - for now, I'll revert to sliders and, if I can resolve question 2 below, to knobs

2 - how to avoid overshoot (as the system rotates beyond the all or nothing catastrophic transition through 0 / 360): is it possible to limit the range of a rotating field set up using constrainCircularCallBack in the same way that one can constrain a slider or by setting the limits in constrainLinearCallBack? e.g. to limit the range of rotation of a knob from between 220 and -40? (anti clockwise readings)

cheers

Nigel

Post Reply