algorithmic modeling for Rhino
I am trying to calculate angles of rotation along a curve for a CNC Tangential knife, where there is a fixed reference angle and I am able to count in the negative direction for clockwise rotation and in the positive direction for counter clockwise.
This is proving difficult for me to come up with an approach that counts beyond 360 or negative 360.
At times I will want to calculate angles for a given curve that may start at a negative angle and then move in the positive direction for several full rotations, then back again.
my working definition came from here...
I got great help last year on working out different strategy that is for positive numbers only with a rollover effect at 360.
http://www.grasshopper3d.com/forum/topics/trigonometry-and-tangenti...
Unfortunately, my Gcode interpreter (Mach3) is very buggy with the rollover strategy, so I am moving to this more stable approach.
Any ideas are welcome. I could really use some advice.
Tags:
I haven't tested this much so I'm not sure if it will work in every situation, but maybe it will at least give you an idea of where to go next.
Instead of always measuring to a fixed reference angle, this definition just measures the angle between the current angle and the previous one. Then it uses mass addition (the list of partial results) to give the current angle. So each angle is just the sum of all the angles before it. This allows them to go above 360 degrees (or below -360 degrees).
The method I use to tell whether or not an angle is negative is by using a plane input for the angle component. Without it, an angle at -30 degrees from 0 and an angle at +30 degrees from 0 will look the same (it will say 30 degrees). So with this plane input, instead of having +30 and -30 = 30, you get +30 = 30 and -30 = 330. So you can stipulate that any angle over 180 degrees is negative (I guess this is not always absolutely the case, but I wont go into that as it should work fine for you).
I don't think I explained that very well as it's late and I'm overdue for some sleep - but hopefully it will help.
P.S. the numbers in the screenshot are kind of jumbled, but the small numbers are the angle values of the current angle minus the previous one, and the large numbers are the sums of each previous angle.
-Brian
Brian,
This looks like it is working really well, and your explanation was clear even with your lack of sleep.
Thanks for pointing me in the right direction... I did not know that by feeding the points into an xy plane component you could determine which angle to use. That is a great help.
Thanks again,
Andy
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by