Grasshopper

algorithmic modeling for Rhino

Hello everybody,

I would like to pick lines through their vector directions or especially lines that are directing in the z direction.

I had the idea selecting them through z vectors, but I don't know how to start on this.

Could anyone please help me on this?

Any help is much appreciated.

 

Views: 3158

Attachments:

Replies to This Discussion

Hi Max, not quite sure if this is what you had in mind.

Attachments:

The "Test vector" with "angle tolerance" is an interesting wrinkle to filter the lines.  I added some visual aids to help me see it better, including the blue "Test vector" in the corner.  Looks to me like you miss lines/vectors "aiming toward you", so to speak, within the same angle tolerance.

Chooselinesbydirection_2016July27a.gh

I applied your data to my code, posted earlier.  As vectors (preview disabled), all the blue lines point down, the yellow up - selectbyvector_d2_2016July27b.gh:

Attachments:

Yes, you're right about my only looking in one direction. Here is my amended code.

Attachments:

You could start by providing some internalized data in a GH file.

The one you posted has no internalized data, not even a single point.  Better would be to provide a collection of lines to study for their directional vector properties, which can only be determined by assuming a vector between start and end points?

Given that (the 'Random Lines' param in attached code), I would answer your question this way:

Attached selectbyvector_2016July27b.gh shows lines or vectors:

Finally, selectbyvector_2016July27a.gh, the code I wrote to create the 'Random Lines' internalized data:

Attachments:

Both are really great approaches, I still can't believe that you can solve such complex issues so fast.

Many thanks I got it done perfectly :)

I think something even simpler is possible! Whenever you want to compare vectors, Dot Product is your friend - with unitized inputs it will return a 0 for perpendicular vectors, a 1 for parallel vectors, -1 for anti-parallel vectors, and values between 0-1 for "pointing generally the same way." The nice thing is this works if the vector you want to test against ISN'T conveniently one of the cardinal axes. (And Joseph - I think you can generate random vectors a bit more easily as well :) )

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