Hi there, i have a few lines, and measuring the angles inbetween.
Now, with the atan function, I calculate the angles, and works fine, however, in different quadrants, the value is either positive or negaitive. Now, for example, my angle go from 60 to 90 degrees, but over 90 degrees it is negative. My goal is to set the fill color of text box green for a travel of for example 80 degrees plus 30, which in normal cases will be 110 degrees. But, hence the travel go through a quadrant, the value turn negative.
Is there a way I can use the value ONLY in an if statement, and disregard the negative?
The other option which I haven't tried yet, is to add 360 to all the angles. But that have its own issues.
Any help will be appreciated
Thanks,
Jakes
if x < 0
Yes, I have used that, but see the red indicated statement below, that doesn't work. it work fine with all the angles in either positive or negative state.
The moment I add another If statement, it onlye use the last one in the block. And to add another "else If" statement, doesnt work either.
That one, and this one
are fighting each other....
Yes, But I cannot find a solution yet. I even tried a If statement whithin another if....
Yes I Know........ Im learning
you need definitive tests. Try using the and & or blocks
this will make the background red if Angle B is between 150 and 160 (there is an easier way to do this!)
The atan2(dx,dy) block avoids all that angle range aggravation.
Post the .aia so we can test?
Got the .aia file.
By the way, your background image labels the shoulder angle as an elbow angle, with a very obtuse angle range.
Is this one of those recumbent bicycles where the rider has to lay on his belly?
haha, no, just a normal bike. The image is just a temporary image, Im going to make my own artwork eventually. Here is a more accurate Image
Were you planning to add constraints on how long you can stretch the rider's arms, legs, etc. while moving the Balls?
I haven't planned to do that. If that will make formulas and calculations easier, it can be done
I got the angles to work with atan2(), and added some procedures and generic events to cut the block count way down.
QuickBikeSetup.aia (1.2 MB)
These 3 procedures do the angle calculation:
I divided up the different problems by procedure:
- relations between balls
- modelling the joint ball as the (x,y) origin for angle calculation
- normalizing the angles into acute range 0 <= angle <= 180
Calling the procedures to update the display:
General cleanup of redundancy:
Sample run (I had to add Labels because I couldn't remember which Label held what angle)
(i don't know why your range tests colored my numbers red, but the angles look reasonable.)
And finally, this is a problem
See the article on opening Screen1 at
Thanks so much for the help. Will test and give feedback. About the range, the template background is just a temporary image, the angles are not even correct. Also, the setup for mtb vs roadbike is slightly different. I have to fine tune the ranges still.
Thanks for the help. Working perfectly. Really appreciate.