Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I have a list of unit vectors. Some of them are opposite(dot product=-1). For every pair of vectors that are opposite, I want to reverse one of them(doesn't matter which one) so that there are no opposite vectors in the end. I've thought about using an Expression component or the KeySearch component, but I haven't been able to make it work so far. Can someone help? Thanks!

Views: 944

Replies to This Discussion

Multiply one vector by the dot product or best do that on expression

if x is dot product and y on of your vector

if(x<0,-y,y)

I'm not  sure I understand how this would work. I am using Cross Reference to get the combinations of the vectors. For example, if the vectors are 90 the results of the dot product are 4005. The expression you suggest gives 40050 results. What I'm trying to do is get 90 vectors in the results.

If the dot product is negative or -1, you could convert that number to a boolean.

If dp>0 = 1 else -1

Then with set amplitude of the vector you can set that lengh, reversing it when is -1.

Post your .gh file for better answer.

This is the .gh file.

Attachments:

Have a look at attached file.

Maybe it helps.

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service