algorithmic modeling for Rhino
Hey everyone,
I've added a bunch (I won't say 'set') of components that expose Mathematical Set like operators. These components work on simple data types only:
You cannot use them on anything else (at present at least). The following examples all use Strings, but that's just to make it obvious what's happening. Basically I'm looking for ideas for other (useful) components that operate on sets.
A note on Sets (read the Wikipedia article for a basic explanation). A Set is a collection of distinct objects. You shouldn't be able to find the same object twice in the same set. Objects inside sets are referred to as "members". Although in actual Set Theory, a set can contain other sets (it could even contain itself), this is not possible within the framework of Grasshopper. It's easiest to think of Sets as special Lists that don't allow more than one instance of a specific value. Some operators require this property, others don't. I might decide not to enforce it after all.
Here's a list of components which I already coded up.
Create Set. Convert a list of values into a proper Set (no duplicates, no nulls):
Set Union. Combine all members of two sets:
Set Difference. Remove all members from A that also occur in B:
Set Symmetric Difference. Remove all members from A that occur in B and vice versa:
Subset. Test whether all the members in Set B are also present in Set A:
Set Intersection. Create a new set which contains all members that are present in A and B:
Set Carthesian Product. (Only works on sets with identical cardinality):
Replace members. Replace all members in A that match some value with another value:
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Tags:
I can definitely see lots of uses for these tools. Specifically, being able to quickly test if a certain set of points is also in multiple other sets of of points could be great. Maybe I am going about it the long way now, but I currently graft each point and then compare it to each member in the other sets. This involves lots of equality components and using the above set tools could do this in one step.
Looking through the Wikipedia entry for sets, I could also see a use for expanding the sets to include some type of fuzzy sets or fuzzy logic. Rather than the binary logic of an item being a set member or not, this would allow you to have degrees of membership. I have no idea how this might be used, but it seems like it could be useful for ranking items according to some type of criteria within a set or multiple sets. For example, if you have two overlapping circles (A and B) and two points that are both located within the overlap, the point closer to the center of circle A could be said to ranked higher if the criteria was to find points that are in both circles AND close to the center of circle A.
Hi Andrew,
there's a bit of a catch though. Unless points are exactly the same, they won't collide. I've added a little bit of tolerance (at the 9th decimal place) but you'll still have rounding thresholds. Making this work well on points, vectors and floating point numbers that are the result of different operations (i.e. when we can expect some differences in the least significant digits) will require a wholly different approach. If I can think of something I'll add it, but don't get too excited yet.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Very Exciting! Thank you!
Regarding point collision, maybe just allow us to broaden the tolerance if need be.
Hi Gabe,
that wouldn't help. When I decide whether or not a member is already part of a set, it needs to have the same hash code. So even if I were to round all coordinates to whole number, 0.500000001 and 0.4999999999 would still end up in different buckets.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
David,
Sorry, I wasn't intending to mean that this would be useful for finding dup points (Daniel's dup points already does this with the added tolerance parameter). Instead I meant that it could be useful for finding if a certain point exists within multiple sets of points. For example, finding if a mesh vertex is shared by multiple faces is a bit difficult now (although I hear that mesh topology components are on their way). It seems like these tools could be helpful in working with meshes by being able to check if the the verticies of face A overlap at all with the verticies of face B. For example, if the set union has a length of 0 then the faces are not adjacent, if the length is 1 it would mean that they share 1 vertex, if it has a length of 2 they would share a mesh edge, and if they have a length of 3 (assuming triangulated mesh) they would be coincident faces. I guess you would actually be working with the vertex indices rather than the actual points, but the idea is similar.
Hi David,
what about rounding components,
able to round numbers and vectors/points
to a given precision ?
Cheers
Emilio
Yes, they will. But I don't know when that will be yet. It will be a few days at the very least.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Is it possible to create an aperiodic set?
Hi Carlos,
what would an aperiodic set component do? Are you referring to Penrose tiling?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by