modern 发表于 2012-11-21 10:00:47

Grasshopper 0.9版的列表匹配

<DIV align=left><FONT color=rgb(51,51,51)><FONT style="BACKGROUND-COLOR: rgb(255,255,255)">
<DIV align=left>As of Grasshopper 0.9 components no longer offer a Cross Reference option in their pop-up menus. This feature was removed because I felt it was not flexible enough. Now, you can achieve Cross Reference matching with a dedicated component which creates combinations of items. You can find the component in the Sets.List panel.</DIV>
                <DIV align=left> </DIV>
                <DIV align=left>
                        <span style="color: rgb(0, 16, 81); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); font-size: medium; display: inline !important; float: none; ">
                        由于Grasshopper 0.9不再在</span><font style="color: rgb(0, 16, 81); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); font-size: medium; ">pop-up菜单中</font><span style="color: rgb(0, 16, 81); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); font-size: medium; display: inline !important; float: none; ">提供列表匹配选项。这个功能的移除,我想是因为它不够灵活。现在,大家可以用一种专门完成项目组合的组件来完成列表匹配的功能。大家可以在</span><font style="color: rgb(0, 16, 81); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); font-size: medium; ">Sets.List面板下找到这种组件。</font></DIV>
                <DIV align=left></FONT></DIV>
<DIV align=left><FONT color=rgb(73,136,2)><U><A href="http://api.ning.com/files/MdLK-pMt4iSrhyKVdsB3OA*h9XG6RDgp5A44GdlK36dmRtfz0VUhhYj4LSfSB3JR2wC*tZsCLNwgpeUiikWZx7GEEdNviduk/CRIcon.png" target=_blank><IMG border=0 alt="" src="http://api.ning.com/files/MdLK-pMt4iSrhyKVdsB3OA*h9XG6RDgp5A44GdlK36dmRtfz0VUhhYj4LSfSB3JR2wC*tZsCLNwgpeUiikWZx7GEEdNviduk/CRIcon.png" width=80></A></U></FONT></FONT></DIV> <DIV align=left>When Grasshopper iterates over lists of items, it will match the first item in list A with the first item in list B. Then the second item in list A with the second item in list B and so on and so forth. Sometimes however you want <I>all</I> items in list A to combine with <I>all</I> items in list B, the component allows you to do this.</DIV>
                <DIV align=left> </DIV>
                <DIV align=left>
                        <span style="color: rgb(0, 0, 0); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">
                        在Grasshopper重复匹配列表选项时,它会将A列表中的第一项和B列表中的第一项相匹配。然后,将A中的第二项和B中的第二项相匹配,依次如此重复。如果你想要A中的所有项和B列表中的所有项相匹配,Cross
                        Reference组件就可以让你完成这种匹配。</span></DIV> <DIV align=left>
                        <FONT color=rgb(73,136,2)><U>
                        <A href="http://api.ning.com/files/OgAXaX8IyibAtK1MPhug3nFwXLhlwzGxOSQKfcakhnRzTYD43EcRkGogxSBmohg4tUU7SgVfXndpwBegBu1wYN-4mKNIsZOo/holistic_canvas.png" target=_blank><IMG border=0 alt="" src="http://api.ning.com/files/OgAXaX8IyibAtK1MPhug3nFwXLhlwzGxOSQKfcakhnRzTYD43EcRkGogxSBmohg4tUU7SgVfXndpwBegBu1wYN-4mKNIsZOo/holistic_canvas.png" width=311></A></U></FONT></DIV>
                <DIV align=left> </DIV>
                <DIV align=left>Here we have two input lists {A,B,C} and {X,Y,Z}. Normally Grasshopper would iterate over these lists and only consider the combinations {A,X}, {B,Y} and {C,Z}. There are however six more combinations that are not typically considered, to wit: {A,Y}, {A,Z}, {B,X}, {B,Z}, {C,X} and {C,Y}. As you can see the output of the component is such that all nine permutations are indeed present.</DIV>
<DIV align=left> </DIV>
                <DIV align=left>
                        <span style="color: rgb(0, 0, 0); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">
                        这里如上图,我们有两个输入列表{A,B,C}和{X,Y,Z}. 正常情况下,Grasshoper只会完成这种组合:{A,X}, {B,Y}和{C,Z}
                        。可是有另外六个组合方式是一般不会被考虑到的:{A,Y}, {A,Z}, {B,X}, {B,Z}, {C,X} 和 {C,Y}。正如你所看到,Cross
                        Reference组件的输出结果正是这所有的9个排列组合的正确呈现。</span></DIV>
                <DIV align=left> </DIV>
                <DIV align=left>We can denote the behaviour of data cross referencing using a table. The rows represent the first list of items, the columns the second. If we create all possible permutations, the table will have a dot in every single cell, as every cell represents a unique combination of two source list indices:</DIV>
                <DIV align=left> </DIV>
                <DIV align=left>
                        <span style="color: rgb(0, 0, 0); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">
                        我们可以用表格来表示数据匹配的行为。这个表格的行表示第一个列表的项,列表示第二个列表项。如果我们创造所有可能的数据匹配,表格会在每一个格子内有一个点,即每一个表格的点表示一种两列表项目的组合匹配。</span></DIV> 
<DIV align=left><FONT color=rgb(73,136,2)><U><A href="http://api.ning.com/files/oDgR-789bYUT9I7UhpxcFFGMTTFQuUUrza3MkGPMrEWFrzuOXTWgDjroVV7gmqxJxIOLsIzzYXIO*NG63D1s7GiB0rDBB0Sc/Holistic.png" target=_blank><IMG border=0 alt="" src="http://api.ning.com/files/oDgR-789bYUT9I7UhpxcFFGMTTFQuUUrza3MkGPMrEWFrzuOXTWgDjroVV7gmqxJxIOLsIzzYXIO*NG63D1s7GiB0rDBB0Sc/Holistic.png" width=110></A></U></FONT></DIV>
                <DIV align=left> </DIV>
                <DIV align=left>Sometimes however you don't want <I>all</I> possible permutations. Sometimes you wish to exclude certain areas because they would result in meaningless or invalid computations. A common exclusion principle is to ignore all cells that are on the diagonal of the table. The image above shows a 'holistic' matching, whereas the 'diagonal' option (available from the component menu) has gaps for {0,0}, {1,1}, {2,2} and {3,3}:</DIV>
                <DIV align=left> </DIV>
                <DIV align=left>
                        <span style="color: rgb(0, 0, 0); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">
                        然而,有时你不想要所有可能的排列组合,而希望排除掉一些无意义或者无效的排列方式。普遍的排除原则是忽略掉所有表格对角线的元素。上图显示了holistic匹配的状况,然而,如下图,diagonal选项的结果有一些缺口:{0,0},
                        {1,1}, {2,2} and {3,3}。</span></DIV>
                <DIV align=left> </DIV>
<DIV align=left><FONT color=rgb(73,136,2)><U><A href="http://api.ning.com/files/8OUJNhqnmLKzA6VR63UWXFcVcHV5jMN3KjO0Wrz3xFWsXMYVqXVGIueGKssBci0d0gGFMHk1SIbjNHSDuvYIZfeMZAjGZGWZ/Diagonal.png" target=_blank><IMG border=0 alt="" src="http://api.ning.com/files/8OUJNhqnmLKzA6VR63UWXFcVcHV5jMN3KjO0Wrz3xFWsXMYVqXVGIueGKssBci0d0gGFMHk1SIbjNHSDuvYIZfeMZAjGZGWZ/Diagonal.png" width=110></A></U></FONT></DIV>
                <DIV align=left> </DIV>
                <DIV align=left>If we apply this to our {A,B,C}, {X,Y,Z} example, we should expect to <I>not</I> see the combinations for {A,X}, {B,Y} and {C,Z}:</DIV>
                <DIV align=left> </DIV>
                <DIV align=left>
                        <span style="color: rgb(0, 0, 0); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">
                        如果我们将这个运用到{A,B,C}, {X,Y,Z}的例子中,我们不希望看到{A,X}, {B,Y} and {C,Z}这三种组合。</span></DIV>
                <DIV align=left> </DIV>
<DIV align=left><FONT color=rgb(73,136,2)><U><A href="http://api.ning.com/files/1exF44HL322Imaerps-Bb774NG0rUheMvdFvNPNyYRD1*dsQpdJhuHdaaM30e8xVCrmKMniexJQ3c4*pcFWjiI3Z1z1Tzlcd/diagonal_canvas.png" target=_blank><IMG border=0 alt="" src="http://api.ning.com/files/1exF44HL322Imaerps-Bb774NG0rUheMvdFvNPNyYRD1*dsQpdJhuHdaaM30e8xVCrmKMniexJQ3c4*pcFWjiI3Z1z1Tzlcd/diagonal_canvas.png" width=312></A></U></FONT></DIV>
                <DIV align=left> </DIV>
<DIV align=left>The rule that is applied to 'diagonal' matching is: <I>"Skip all permutations where all items have the same list index"</I>. 'Coincident' matching is the same as 'diagonal' matching in the case of two input lists which is why I won't show an example of it here (since we are only dealing with 2-list examples), but the rule is subtly different: "<I>Skip all permutations where any two items have the same list index</I>".</DIV>
                <DIV align=left> </DIV>
                <p>
                <span style="color: rgb(0, 0, 0); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">
                这种diagonal匹配运用的规则是:跳过所有具有相同列表索引的项目之间的排列组合。Coincident组合和diagonal组合在一种情况下相同,即当输入端为两个列表时,所以这里举的这个例子无法反映出区别。但是Coinciden的规则有细微的差别:跳过所有任何两个项目有相同的列表索引的排列组合。</span></p>
                <DIV align=left>The four remaining matching algorithms are all variations on the same theme. 'Lower triangle' matching applies the rule: <I>"Skip all permutations where the index of an item is less than the index of the item in the next list"</I>, resulting in an empty triangle but with items on the diagonal.</DIV>
                <DIV align=left> </DIV>
                <DIV align=left>
                        <span style="color: rgb(0, 0, 0); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">
                        这四个剩下的匹配算法都是在相同主题下的变化。Lower
                        triangle匹配的规则是:当一个列表中项目的索引值比下一个列表中项目的索引值小时,跳过这种排列组合。这种算法的结果如图,右上角有了三角空白区域。</span></DIV>
<DIV align=left><FONT color=rgb(73,136,2)><U><A href="http://api.ning.com/files/7tuGUxwUu8HWO7gHvNq9Z0D8u92DC6tkHvC8CdneHVe9jnF4a-1MCT5JeqtdQf08cAzBg41FxfJire8PpSG9gfU0XmMQHKAk/lower_canvas.png" target=_blank><IMG border=0 alt="" src="http://api.ning.com/files/7tuGUxwUu8HWO7gHvNq9Z0D8u92DC6tkHvC8CdneHVe9jnF4a-1MCT5JeqtdQf08cAzBg41FxfJire8PpSG9gfU0XmMQHKAk/lower_canvas.png" width=428></A></U></FONT></DIV> <DIV align=left>'Lower triangle (strict)' matching goes one step further and also eliminates the items on the diagonal:</DIV>
                <DIV align=left> </DIV>
                <DIV align=left>
                        <span style="color: rgb(0, 0, 0); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">
                        Lower triangle (strict)的匹配,比Lower triangle多消除了一列斜边。</span></DIV>
<DIV align=left> </DIV>
                <DIV align=left><FONT color=rgb(73,136,2)><U>
                        <A href="http://api.ning.com/files/MdLK-pMt4iT-fRcZr38tGNu4kvJL78H*jM5xU9kwWJdIdvTC8-sWih13KRLAWe9nhGipGm*GPPq0DfebSmW1NaxNtjDDnovF/lowerstrict_canvas.png" target=_blank><IMG border=0 alt="" src="http://api.ning.com/files/MdLK-pMt4iT-fRcZr38tGNu4kvJL78H*jM5xU9kwWJdIdvTC8-sWih13KRLAWe9nhGipGm*GPPq0DfebSmW1NaxNtjDDnovF/lowerstrict_canvas.png" width=423></A></U></FONT></DIV>
                <DIV align=left> </DIV>
                <DIV align=left>'Upper Triangle' and 'Upper Triangle (strict)' are mirror images of the previous two algorithms, resulting in empty triangles on the other side of the diagonal line:</DIV>
                <DIV align=left> </DIV>
                <DIV align=left>
                        <span style="color: rgb(0, 0, 0); font-family: Serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">
                        Upper Triangle和Upper Triangle
                        (strict)是之前两种算法的镜像图像,结果在表格的另一边空出了三角区域。如下图:</span></DIV>
<DIV align=left> </DIV>
                <DIV align=left><FONT color=rgb(73,136,2)><U>
                        <A href="http://api.ning.com/files/x1FR6nDtQ8KzzKMUs1tOUHGPqEi9BxZ2gkJ3Tuyuqk96BiqK5h5qSqnDyrYazS6*o0bq8NlLCrIwhEtjz-e4iMvLQ3JmHBIw/upper_canvas.png" target=_blank><IMG border=0 alt="" src="http://api.ning.com/files/x1FR6nDtQ8KzzKMUs1tOUHGPqEi9BxZ2gkJ3Tuyuqk96BiqK5h5qSqnDyrYazS6*o0bq8NlLCrIwhEtjz-e4iMvLQ3JmHBIw/upper_canvas.png" width=417></A></U></FONT></DIV> 
<DIV align=left><FONT color=rgb(73,136,2)><U><A href="http://api.ning.com/files/lrVtZLXG5yMdJA3KAItzj34O8YpMxLIYuF04AqV8-CypoKfOyx8Wyx1gdvnBUhO7zej4Hq0WLWxZ3z0jKz02Xgpj1NvDLJe1/upperstrict_canvas.png" target=_blank><IMG border=0 alt="" src="http://api.ning.com/files/lrVtZLXG5yMdJA3KAItzj34O8YpMxLIYuF04AqV8-CypoKfOyx8Wyx1gdvnBUhO7zej4Hq0WLWxZ3z0jKz02Xgpj1NvDLJe1/upperstrict_canvas.png" width=420></A></U></FONT></DIV></DIV>

colonnade 发表于 2017-12-23 15:07:56

:)

tsone 发表于 2018-1-14 12:50:58

wow, that`s very helpful.
页: [1]
查看完整版本: Grasshopper 0.9版的列表匹配