Hello,
I have been puzzling for days on how to group points by their line associations.
When I input both sets of horizontal and vertical curves in the multiple curves component I get a flat list of all intersection points for each path. I have tried using the iA and iB in order to associate and group each point for each curve respectively, but have no luck using ‘create set’, and member ‘index’. To further complicate the issue, certain points are a result of the intersection of two curves internally within either the horizontal path or vertical path respectively. If anyone could help me figure out how to attack this I would be grateful.
You are losing your data structure in the multiple curves intersection, so I would cross-reference between each curve and find an intersection between each pair of curves.
For calculating the intersection points of multiple curves, I would more recommend using CCX (Curve | Curve), because its data structure is simpler and easier to understand. I’ve created an example based on the file you provided. I hope it will be helpful to you.
And what will you do about the intersection of horizontal with horizontal lines?
You don’t really fully lose your data structure in multiple curves intersection, since you can retrieve the vertical and horizontal lines from their indices.
just one thing, these two points are intersections between two same goups of horizontal/vertical curves, so they are not found with CCX because it only finds horizontal intersecting with verticals, not horizontals intersecting within other horizontals / verticals intersecting within other verticals:
@Gijs_Jonkheer This script continues from your first, but feeds a merged set of the horizontal and vertical lines into Cross Reference so that either the horizontal or vertical lines (depending on which of these two you chose to create a tree for) are compared against all lines for Curve Intersection. For this, the order of the merge and setting Cross Reference to “diagonal” is important. The tree is already created at the CCX; all that the rest of the script does is clean things up, so that the data tree is structured by the index of the horizontal/vertical curves, and that the intersection points are indexed sequentially on the curves.
…for me juggling with Datatrees with vanilla gh-components always feels a bit like alchemy.
here is a scripting solution.
I did not push it to the minimum (of lines) and added a few comments…
not sure if this is a great coding-learning-example as it uses code not for a specific solution-strategy, but only to overcome gh’s limitations regarding the idea of mixing Data-Structure and logic.
The script mainly sorts some data to access Rhino.Geometry.Intersect.Intersections.CurveCurve (in one line) and then sorts the result back into a Datatree.
For most scripting components you will not to create a tree by yourself. I recommand to start with simple scripts where the accesslevel is “Item”.