Data Structure – Grasshopper
Filters – One of the effects of the lack of “physical” interaction in grasshopper is the seemingly difficulty in selecting items among a set of objects. In this example two curves are drawn and assigned to two different “curve” components curve1 and curve2 and then divided into 6 parts using the divide component and a slider. As a result, seven parts are generated on each curve. A simple operation such as connecting a specific or arbitrary points among the 14 division points seems impossible. Connecting a line component to the P-output of the two Divide Curve component will generate 7 lines connecting the entire set of corresponding points.
![FILTERS_GH](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_GH.jpg)
Grasshopper structures data into paths, hierarchical levels that contains data list (arrays). These are further subdivided into items which are index (0 to i) to reference an item’s position
![FILTERS_list2](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_list2.jpg)
List Item – Select a specific item form a list. Understanding a lists allows us to select a specific datum within a List by referring to its index by a filter.
![FILTERS_item](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_item.jpg)
In order to select two or more items, several sliders can be connected to the i-input of the component List Item, by using the Merge component
![FILTERS_item_mergedata_3](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_item_mergedata_3.jpg)
Cull Index – The Cull component deletes a specified index items from a list.
![FILTERS_cull_2](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_cull_2.jpg)
Cull Patten – Using repeating boolean values of true and false can be used to select and exclude items from a list. Cull Pattern component is used to to filter lists according to a repeating pattern of boolean values.
![FILTERS_cull_pattern2](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_cull_pattern2.jpg)
Shift List – Shifts index numbers, upwards and downwards. S-input is the shifting offset, the L-input is the list to shift, and the W-input is a boolean parameter which declares if the resulting shifting should be re-appended.
![FILTERS_shiftList](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_shiftList.jpg)
![FILTERS_shiftList_2](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_shiftList_2.jpg)
Split List – Splits a single input list at a specific index into two list A and B. List Length would let you access the length of the list if you plug it to a Panel
![FILTERS_SPLIT_3](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_SPLIT_3.jpg)
Reverse List – The Reverse List component reverses the order of the list. Index 0 is set to index 10, index 9 into 1 , etc. Every input slot embeds the functionality to reverse input data by right-clicking the slot and choosing Reverse from contextual menu.
![FILTERS_reverse](https://lramrz.com/wp-content/uploads/2018/02/FILTERS_reverse.jpg)