gh列表交叉原理

来源:互联网 发布:vb中trim是什么意思 编辑:程序博客网 时间:2024/05/01 23:56

我们来自江河梦小组(Scond Effect Group),工程用到gh,所以必须学习好GH插件,而大部分权威资料都来自国外,所以就组织组员翻译来自GH官方论坛的帖子,以便学习。下面是一篇David的帖子讲解列表计算的交叉原理,由黄思颖同学翻译。

Cross Reference; what is it, howdoes it work, why would I need it?列表交叉,是什么,如何工作,为什么需要它?

·      Posted by David Rutten on August 1, 2012at 4:31pm inFAQ (FrequentQuestions and Problems)

·      Send MessageView Discussions

As of Grasshopper0.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, youcan achieve Cross Reference matching with a dedicated component which createscombinations of items. You can find the [Cross Reference] component in theSets.List panel.

GH0.9运算器不再在顶部主菜单中提供列表交叉选项,它被移除我认为是因为它不够灵活。现在,你可以用一个专门的运算器结合条目来实现列表交叉匹配。你可以在Sets.List面板中找到[Cross Reference]这个计算器。

 

When Grasshopperiterates over lists of items, it will match the first item in list A with thefirst item in list B. Then the second item in list A with the second item inlist B and so on and so forth. Sometimes however you want all items inlist A to combine withall items in list B, the [Cross Reference]component allows you to do this.

GH迭代多个条目的列表时,它将列表A中第一个条目与列表B中第一个条目匹配,然后是列表A中的第二个条目与列表B中第二个条目,接下来以此类推。然而有时你需要所有列表A中的所有条目分别与B中的所有相组合,[列表交叉]允许你这样做。

 

Here we have twoinput lists {A,B,C} and {X,Y,Z}. Normally Grasshopper would iterate over theselists and only consider the combinations {A,X}, {B,Y} and {C,Z}. There arehowever 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 [CrossReference] component is such that all nine permutations are indeed present.

现在我们输入{A,B,C}{X,Y,Z}这两个列表,一般GH迭代这些列表仅仅考虑这三种组合{A,X}, {B,Y} {C,Z}.然而还有六个组合没有考虑到,那就是{A,Y}, {A,Z},{B,X}, {B,Z}, {C,X} {C,Y}。你可以看到列表交叉运算器所有的九个排列都有输出。

We can denote thebehaviour of data cross referencing using a table. The rows represent the firstlist 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 aunique combination of two source list indices:

我们可以用一个表格来表示其内部运作。行代表第一个列表的条目,列是第二个。假如我们列出所有排列,表格里每个小格子都有一个点,每个小格子代表唯一一个两列表的索引组合。

Sometimes howeveryou don't wantall possible permutations. Sometimes you wish to excludecertain areas because they would result in meaningless or invalid computations.A common exclusion principle is to ignore all cells that are on the diagonal ofthe table. The image above shows a 'holistic' matching, whereas the 'diagonal'option (available from the [Cross Reference] component menu) has gaps for{0,0}, {1,1}, {2,2} and {3,3}:

然而有时你不需要所有的排列,你想排除某些无意义或无效计算的区域。普通的排除法则是忽略表格中对角线上的所有小格子。下面有个写着“全盘”的小图标,“对角线”选项(在列表交叉运算器中有)空白处有{0,0}, {1,1}, {2,2} {3,3}

If we apply this toour {A,B,C}, {X,Y,Z} example, we should expect tonot see thecombinations for {A,X}, {B,Y} and {C,Z}:

把这个运用到{A,B,C}, {X,Y,Z}例子中,我们可以想象将看不到{A,X}, {B,Y} {C,Z}这几个组合:

 

The rule that isapplied to 'diagonal' matching is:"Skip all permutations where allitems have the same list index". 'Coincident' matching is the same as'diagonal' matching in the case of two input lists which is why I won't show anexample of it here (since we are only dealing with 2-list examples), but therule is subtly different: "Skip all permutations where any two itemshave the same list index".

适用于“对角线”匹配的规则是:跳过所有条目都有着相同列表索引的排列。对于两个输入列表,Coincident匹配与diagonal匹配是一样的,所以在此我不再举例(我们仅仅处理两个列表的例子),但其规则细说起来是不同的:跳过任意两个条目有相同列表索引的排列。

The four remainingmatching algorithms are all variations on the same theme. 'Lower triangle'matching applies the rule:"Skip all permutations where the index of anitem is less than the index of the item in the next list", resultingin an empty triangle but with items on the diagonal.

剩下的四个匹配算法正如同一主题的所有变奏曲。Lower triangle匹配使用法则:其中一个条目的索引少于在另一个列表中该条目的索引时,跳过该排列。结果产生一个空的三角形,但对角线上非空。

'Lower triangle(strict)' matching goes one step further and also eliminates the items on thediagonal:

Lower triangle(strict)匹配更进一步,也排除了对角线上的条目。

'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:

Upper Triangle''Upper Triangle (strict)是之前两个算法的镜像。结果产生对角线另外一边的空白三角形。

Views: 7529

窗体顶端

▼ Reply to This

 

{#aria.rich_text_area}

 

{#advanced.toolbar}

Link

Image

Media

Paste    as Plain Text

Bold

Italic

Strikethrough

Underline

Left

Center

Right

Blockquote

Unordered    list

Ordered    list

HTML    Editor

 

Upload Files

Attach files (limit: 5MB)

§ 

§ 

§ 

Follow – Email me whenpeople reply

窗体底端

Replies to ThisDiscussion

Permalink Reply by Ángel Linares on August 1, 2012at 5:18pm

The component looksamazing. Nice idea implementing all this functions and different combinations:)

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Yasser Hafizs on August 2, 2012at 10:30am

Awesome, Thanks David.

How about this feature? I've seen before in the forum, did this featureavailable too?

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by David Rutten on August 2, 2012at 12:57pm

Hi Yasser,

not like that, at least not yet. You can enter paths into a parameter SetMultiple... item:

--

David Rutten

david@mcneel.com

Poprad, Slovakia

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§  Message

Permalink Reply by Yasser Hafizs on August 3, 2012at 7:35am

I see. Thank you

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Diego Porr on August 3, 2012at 11:52am

Hi David, i hope you can answer me this question...

How could you usethis component to make this combination: AX, AY, AZ, BX, BY, BZ, CX, CY, CZ?

怎样使用这个运算器得到这种组合:AX, AY, AZ, BX, BY, BZ, CX, CY, CZ

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Garcia del Castillo on August 3, 2012at 12:42pm

Remember to plugthe graft at output B first.

记得在输出端B处点graft选项。

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Garcia del Castillo on August 3, 2012at 12:43pm

PNG transparency not working properly?

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Danny Boyes on August 3, 2012at 12:44pm

That's the same asthe first example Holistic

§  和第一个例子一样。

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Danny Boyes on August 3, 2012at 4:07pm

An alternative to String Join is Concatenate

交替字符串的连接

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Diego Porr on August 4, 2012at 9:46am

I wanted to createa dot matrix which in the past Grasshopper version was too easy by clicking'cross reference' on component's pop-up menu. I finally used f(x,y)= x+y with Aand B outputs of cross reference component. Thank so much for your help guys.

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Lucybell on September 20,2012 at 7:05pm

Hi! David.

I have a problem, I want to build a surface from points generated by theparametric form but using cross references for every single parametricfunction, only describing the edge.

how I can fix that?

Thanks for help me

Lucibell

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Hi Lucybell,

I think it's better if you post on themain forum and attach thefile so people can see what you've got. More people will see it over there.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§  Message

Replies to This Discussion

Permalink Reply by Lucybell on September 21,2012 at 4:21pm

Thank you David!

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Jesus Galvez on November 21,2012 at 7:19am

Good thing there isthis reference. I doubt I would have understood it on my own.

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by mnejjahoussem on March 17, 2013at 4:01pm

thanks

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by Jun Luke Wang on March 28, 2013at 9:09pm

This is really helpful David.

I'm not sure ifit's out there already or am I asking too much, but a documentation package ofall grasshopper component like this it's gonna be like an amazing Easterpresent:)

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§   

Permalink Reply by David Rutten on March 29, 2013at 1:45am

We've started working on a better help system. It'll be a very long termproject and I'm not sure when the first topics will become available. Possiblynot before we get to GH 2.0 Beta.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

§   

窗体顶端

► Reply

Upload Files

Attach files (limit: 5MB)

    •  
    •  
    •  

窗体底端

§  Message

Permalink Reply by Jun Luke Wang on March 31, 2013at 7:30pm

Thanks David,

It feels as niceknowing it's underway.

§   

窗体顶端

► Reply

l窗体底端

原文地址

http://www.grasshopper3d.com/forum/topics/cross-reference-what-is-it-how-does-it-work-why-would-i-need-it

 

原创粉丝点击