Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I am looking to solve two problems. I tried different methods but it doesn't work.

1. I have a list of boxes. the boxes are intersecting with each other.

I want to count how many boxes are intersecting with each box in the list.

2. Also I have another list of boxes. the boxes are adjacent to each other.

I want to count how many boxes are adjacent to each box in the list.

any idea how to do that in grasshopper?

Thank you,

AA

Views: 1723

Attachments:

Replies to This Discussion

I tried to work with cluster that you made you used include as an input and the output was a vector.

Why you made it as a cluster?

and why when I open it it dose not have include it has exclude only?

Thank you for your help

Sorry for the confusion...that label might be a relic from when the logic was the opposite way around in an earlier solution.
Originally it was exclude items rather than include, just ignore this label, it is include.
To cut a long story short I was originally thinking to exclude self because you don't want to count yourself. I then realised its better to classify all other possibilities and make it inclusive with a checklist.... You could of course create other classifications such as above, below, behind, in front, 2 away, 3 away etc

I meant to put this control on the outside of the cluster.

Attachments:

Nicely done!  But... but... his original boxes were overlapped horizontally and/or vertically, eh?  Didn't make much sense so I gave up quickly, but was thinking along similar lines - as you say in your code:

you can tell whether its adjacent to another by the indices rather than doing any geometric functions which is always more processor intense.

Sorry, I am still learning and I did not know that I have to divide the dimension by 2. That is why I made version 2 of the file.

I have to learn more I am really excited to learn more. any suggestion ... Reading, videos that explain the idea of indices in GH.

Thank you

I put together a storyboard, scratch the surface tutorial on paths here...http://www.grasshopper3d.com/xn/detail/2985220:Comment:1792378

But I dont understand how you built the checklist I mean it is my first time to see this node. how it works?

Its on the params input ribbon....drop down component....you can change its type by right click.


Also another tip... Any component you don't know....hold Ctrl + alt and click and hold on the component....it will display arrows to where in the ribbon you'll find it. (Unless its a cluster which won't be in the ribbon and then you'll know to double click it instead)

To build a list, on this component you double click it and make entries in a text panel
Each entry is a new line
Each entry is display name followed by = followed by output value

In this case the output values are a series of : separated vectors which are internally parsed using the split text component.

'hold Ctrl + alt and click and hold on the component'  this is very useful

I don't understand "Each entry is display name followed by = followed by output value". And how you pick those values?

OK... If you think of the perspective of a random box, you have potentially 26 boxes adjacent to you in all directions. {0,0,0} is you, and all the others are relative to you.

-1,0,0 is the box next to you in the x direction and 1,0,0 is the other side of you in the x direction, if you do this for all possibilities you end up with the list defined.
All the faces are when there are two 0s in the vector (6 of these exist) all the edges when there is one 0s in the vector (12 exist) and all the corners when there are no 0s in the vector. (8 exist) giving 26 relative position to the centre in total

These relative positions are than applied to the absolute coordinates, (remember we are using paths as a quasi coordinate system.)
If a path is not found it means it doesn't exist and therefore is not adjacent. If one is found it is returned, ...if a path has been found 6 times it will appear in its own list 6 times. So all we need to do is measure the list length at each path
Using paths as a secondary coordinate system is good for this example where the boxes themselves have there own xyz coordinates, but generally its not typically the way paths are used.

There are many ways you can achieve auxiliary coordinate systems, paths is a discrete coordinate system whereas xyz, uvw etc are continuous coordinate systems. Youre project is a regular 3d voxel grid so a discrete coordinate system works well.

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