Vector Angle 360 degree rotation

Hello!

I’m trying to find the angle between 2 vectors so that the first vector would be the one from which the angle to the second would be measured clockwise.

I read through some posts here but could not find an answer. I have attached what I have tried so far.

Thank you very much!

vector.gh (17.8 KB)

You can use the “Rotate” component, feed the initial vector into the G input, feed the start point of the initial vector into the C input, feed the desired rotation value into the R value and right click on R input and select “degrees”.

The output should be a new vector rotated clockwise (or counter if given a negative rotation value) by your rotation degrees.

You can feed multiple rotation values into the R input and graft them to get multiple rotated vectors.

Does that make sense for your purposes?

1 Like

I see several issues here.

  1. There is no point in grafting the single curve/vector (your first param) so I grafted the other one (three curves/vectors), though that isn’t necessary.

  2. You don’t need Python for a simple “if” statement, you can use an Eval component instead, with the ‘F’ input set to “if(x > 0, R, A)”.

  3. The three curves/vectors are not in correct sequence, as you can see by the numbered midpoints.

  4. The direction of all curves/vectors is not consistent. I don’t show this but the single curve/vector and one of the three curves/vectors start in the center, the other two end at the center.

To fix these issues, I created a new set of vectors, similar to yours but the single curve/vector is on the right instead of at the bottom. All curves/vectors end at the center and are in counter-clockwise sequence, same as the points on the circle. Oh, you wanted “clockwise” so I just added Flip Curve to the circle (yellow group).


vector_2023May25b.gh (16.6 KB)

NOTE: Composing this post took far longer than finding and fixing the issues!!!

1 Like

Signed Vector Angle from froGH.

1 Like

I’ll bite - where does one find Signed Vector Angle? Maybe R8 WIP?

from froGH :question:

froGH | Food4Rhino
They also developed an addon called Tissue in Blender. Quite respected…

It’s not that I hate plugins, I’d just rather understand how it’s done with conventional components (if possible) instead of resorting to a black box. I’m sure it’s still important to be sure about the sequence and direction of vectors that feed it, eh? These are the vectors we were given:

I can create a svAngle cluster (green group) using the code and vectors I posted.


vector_2023May25c.gh (11.4 KB)

The cluster:

vector_2023May25c2

4 Likes

Thank you very much, I was able now to understand the problem, fixing the curves was a bit changed since I have many (the file I uploaded was of course an example), but I have managed :slight_smile:
Thanks a lot!