Need help with trees (what a shocker!) :D

Can anyone please assist me with the mess I’m in?
The basic idea is that I have a grid of rectangles, constructed a diagonal for each rectangle, divided the diagonal based on the results of an image sampler and then I create lines from these division points and one other point. What I want to do next is to intersect(+shatter) each cell (rectangle) with its corresponding lines and keep only what is inside the cell.
After two hours of grafting, flattening and suirifying no luck…!
Sampled image:
sampler|500x500 (680.9 KB)

Side note: internalizing the image used in an image sampler is not possible, right?


Not sure if this is what you’re after?

If so, I didn’t bother trying to shatter the curves you already had, but just created new lines between the division points and the intersection points. I also got rid of the first and last division points as these are by definition coincident with the rectangle itself, so would produce a line of zero length. (682.0 KB)

1 Like

Hi Matt
That’s exactly it! Thank you!
I’ll take a look at the definition and maybe I’ll get closer to grasping the truth about forestry! :smiley:

Good stuff, glad to help. The answer wasn’t so much in the tree structure but more of finding a simpler way to achieve the same result. Rather than trying to figure out which end of the curve was shattered into the smaller section and then pulling that out etc etc, instead you can just join the intersection point with the division point to create the line you want.

1 Like

Yes. A much more elegant and efficient solution, no doubt. It is clear that after struggling with doing it my way I was in a tunnel vision situation where I couldn’t see the forest because of the trees.
(I think, in the end, I’ll manage to recycle all the puns related to trees ever used on the forum…)
Once again: huge thanks!