Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Trick for notes arranged in an elipse (2007-08-05)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1186344258

Message started by Peter Sass on Aug 5th, 2007, 4:04pm

Title: Trick for notes arranged in an elipse (2007-08-05)
Post by Peter Sass on Aug 5th, 2007, 4:04pm

On the Tinderbox 4.0 page at http://eastgate.com/Tinderbox/updates/Tinderbox400/rules.html there is a picture with notes arranged in a neet elipse along with the following line:
theta=($SiblingOrder*6.28)/($ChildCount(parent));Xpos=6*cos($theta) . It looks so good, but I can't do it. I suppose that the syntaxline is what has arranged the notes automaticaly, but I cant make it work. Where should I put that line. Is it an on add action or what? - Peter Sass

-

Title: Re: Trick for notes arranged in an elipse (2007-08
Post by Mark Bernstein on Aug 5th, 2007, 5:38pm

It's a rule (inherited from a single prototype)

    theta=($SiblingOrder*6.28)/($ChildCount(parent));Xpos=6*cos($theta);Ypos=4*sin($theta)

You could do this as an OnAdd action, too, except that the SiblingOrder of the added note won't help us because the note hasn't quite been added yet.  But you could do something like

       theta=($ChildCount(parent)*6.28)/(1+$ChildCount(parent));Xpos=6*cos($theta);Ypos=4*sin($theta)

Of course, you'll need to make a numerical attribute for theta first!

Hint: when debugging complex actions and rules, if things aren't going as you expect, use KeyAttributes to inspect what values are being assigned.  In this case, I forgot to make the user attribute for theta; when things weren't positioned as I expected, I told myself, "let's see what is stored in theta!"  And, of course, there was no theta. Problem solved.

Title: Re: Trick for notes arranged in an elipse (2007-08
Post by Peter Sass on Aug 6th, 2007, 5:01pm

Thank you, Mark, for this. I can make the rule work now, and I think this trick is a cool feature, made possible in 4.0. I have taken the liberty to put it in the wiki, as I find it so useful.

The on add action you suggested does not work as expected, but I find the rule a more practical solution anyway. With the on add action the notes seem to follow the curve of an elipse, but are placed with a smaller and smaller distance like on a logarithmic scale, so they only trace as far as a quarter of the elipse. Maybe somebody can see the bug? I am an ignorant in math and can't spot it.

If anybody has thought up other cool ways to use the new sinus and cosinus functions, then it would be interesting to hear about it.

Peter Sass

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.