Grasshopper

algorithmic modeling for Rhino

Create true/false list that inverse at certain index

Hello,

I have a set of points, I create lines between them and check if the angles between those lines are larger than 89°. 

I would like to separate these lines in two list, let's say true and false. The rules to dispatch the lines are the next:

I start with a list that alternate true/false; like that: true, false, true, false.

If the angles between those lines are greater than 89° I want to inverse the next part of the list:

True, False, True, False, True, False,...

become

True, False, [>89°] False, True, False, True, [>89°] True, False,...

I managed to create a true false list, to check for the greater than 89° angle, to separate the lines relatively to the angles, but I don't know how to inverse part of the list at certain index.

(In the picture, I have written 90° but it should be 89°, I check for greater than 89° and not equal to 90° because in the real rhino model, the lines won't be exactly orthogonal)

If you have another idea to to reach the same result, it's also okay, I tried to find rules to solve the problems, but I may have overlooked other solutions !

And if there is some part of the patch that are correct but there is easier solution, I would love to learn as I am still new to grasshopper.

Thanks for taking the time to read. :)

Views: 1335

Attachments:

Replies to This Discussion

The issue you looking for has nothing to do with the line themselves, but mainly the point of connect (green points) between two lines is the important issue ( the angle point) 

Then you can join the two curves(after flipping the shifted list direction, so you can get angle) 

the Blue ribbon are the corners which is more than 180 degrees(turning left)

red ribbons are the one which is smaller than 180 (turning right)

yellow ones are the ribbons which are straight 

Attachments:

Hi Mohamed, Thank you for taking the time to answer me, the picture really helps.


Unfortunately, I probably wasn't clear enough and explaining my problems with this shapes and angles was a mistake. I decided to concentrate my effort today on this problem and manage to come up with a solution !

I will explain it if somebody else is looking for a similar solution.

Finally my only problem was to create an alternating true/false list that inverse at certain index, this what I came up with: I have a list of points and random index , the box and sphere represent true and false, and the blue sphere is the node(index) where I want to see an inversion.

In reality, it was pretty simple, I just didn't know the right modules. (In yellow, it's the most important part of the patch)(Sorry for the spelling mistake)

Here is a diagram of what I did: I created a list going to 1 to [number of lines], here it's 1 to 10, I had node at 3-4 and 7-8. For each node I created a list of 1 repeated [(number of lines)-index] times. Here, 7 (10-3) and 3 (10-7) times.

After grafting everything, I add everything in mass addition module. I had my final list which I checked if it was divisible by two.

It was more of a logic problem than a grasshopper problem.

Here it is the initial shape with what I wanted !

Attachments:

I got what you mean, I tried something, I know its wrong, but its close to what you need

what it do: it run a Reciprocity (True / False) but when the indexes you selected come, it only alter the status of the value at that index 

Attachments:

I guess this is the answer

check this one 

Attachments:

check image 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service