Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Trick for notes arranged in an elipse (2007-08-05) (Read 6719 times)
Peter Sass
Full Member
*
Offline



Posts: 9

Trick for notes arranged in an elipse (2007-08-05)
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

-
Back to top
 
« Last Edit: Aug 05th, 2007, 4:06pm by Peter Sass »  
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Trick for notes arranged in an elipse (2007-08
Reply #1 - 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.
Back to top
 
 
WWW   IP Logged
Peter Sass
Full Member
*
Offline



Posts: 9

Re: Trick for notes arranged in an elipse (2007-08
Reply #2 - 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
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print