Curves intersection Grasshopper Galapagos

Hi everyone,

I’m trying to modify the shape of a lower curve in order to find the “ideal” curve, the one where, from each point on it, there’s a clear view to the mountain top.

I’m using the Galapagos solver and optimizing for the maximum sum of angle measurements. You’ll notice that some of the view lines (in white) intersect with geometry — these should not be considered valid view lines, and I need to exclude them.

I’ve also tried shifting the list so that the lines don’t originate from exactly the same point, but that didn’t solve the problem either.

You can find GH definition here.

I’m confused because the red lines and the view lines (white) don’t appear to be intersecting as expected. What am I doing wrong?

Thanks in advance for any help!



Question 2.gh (58.0 KB)

I tried to understand what you are working on.
At least noticed that the mountain top point was not internalised. But no idea where this has to be placed.
Can you bring the issue back to a small example, so it is more easy to see what you are looking for? Regards, Eef

Hi Eef,

Thank you very much for the feedback! While I was creating the smaller example, I accidentally solved the intersections by shifting the list (by -1), it seems to be working now!

Please find attached the updated GH file.
The final step I needed to do was to split the list of curves (Curves A) into two groups:

  1. Those that intersect with Lines B
  2. Those that do not

I tried using the parameter values from the intersection points, but it required a different approach. Maybe you could help me with that?

Lines intersection.gh (41.9 KB)

Dear Nadya,

I did some tests and could conclude that all your lines lay in the same plane.
That is why you also get intersections with checking with the -1 list.
(if your mointain top is moved a bit in the Z-plane, you will loose those intersections).

Just working with the two lists as they are (your example on the bottom) does exactly what it should do and gives you 44 intersection points.
the intersections works in pairs: intersections of numbers 1 of both lines; numbers 2 etc
If you set one of the two lists to “Graft” every line will be checked on its intersection with all the lines of the other set

To get the lines what are intersected, there are several ways to do it . This is my Quick and Dirty one. FInd the closest distance, (find the index length (9) in this case) and sort the list of all lines and split at number 9

In case you want to do the same with 3D shapes, you could use the same technique: Lines from mountain top to a dot on the surface of 3D shape. Use Brep |Line to find intersection points, etcetera

Lines intersection_Eef.gh (20.3 KB)

Dear Eef,

Thank you for your reply, it really helps!

Indeed, all the lines I’m trying to find intersections are on the same surface. These lines, which point toward the mountain top (lines A), are projections of the actual visual lines. The overall goal of my approach is to generate an “ideal” facade line, from which each point (a hotel room) offers a great view of the mountain top.

Here’s a breakdown of my intended logic:

  1. Create a parametric curve by points (controlled by Galapagos Genome) - you saw it moving in the first video.
  2. Connect points on this line to the mountain top using the real Z-coordinate.
  3. Project these lines onto a flat surface (lines A).
  4. Find intersections between the projected view lines and the vertical lines (assuming that if view lines intersect geometry there is no view). - PROBLEM
  5. Exclude any view lines that intersect with the facade. PROBLEM
  6. Calculate total sum of the angles between each view line (not excluded) and the X-axis — a larger angle indicates better visibility.
  7. Use this sum as the fitness value for Galapagos, optimizing for the highest total angle.

While reading your comments, I realized I jumped to a conclusion too quickly about my intersection logic working correctly. I mistakenly assumed that shifting the list meant the view line was intersecting with the neighboring line on the left and that was enough, but this led to many missed intersections (see them in yellow)

Now I’m wondering: how can I solve this? I tried grafting one of the lists, as you suggested, but that caused issues due to finding all intersections - since the lines originate from the same point.
Points in blue zone are actually the “good” intersections, which I do not want to consider.

Also, your explanation about filtering the lines made a lot of sense — thank you! I just need to correctly filter out the view lines (lines A). When I try to link these lines to the list, it doesn’t seem to work. I’ll attach a screenshot for better clarity.

Thanks again for your help!

the logic is not “simple” for me. So let me ask about that first:

Looking at the image (below) the mountain top is in the upper left corner.
If every point (red) is a room, then rooms to the right have no view on the mountain because the building is in between?
At least the ones (close to the blue ones, you explained, have a problem.
What about the others to the right? Do they have a view over the building? In the “flat projection” the building is also in between? Or not?
I guess this is all fine in your thinking/visualisation, but not (yet) in mine.
If my assumptions are right, then any of the A lines what intersect more then 1 time
with any B-line has a problem. Correct?

(then the intersect component with 1 list grafted will show these intersections. )
and lines with more then 1 intersection you want.
At the endpoint of these lines lays the hotelroom, you need to know?

Maybe I am completely confused, if so, try to explain. Regards, Eef

If my assumptions were correct this might help:

t

What it does:

  • It turns your points into a curve (probably the same as you started with
  • using extrude → Z to turn it into a surface
  • used your original mountain top.
  • the slider may be used to shift your rooms up a floor or more up
  • now the main component is SCX. It not only gives the intersecting points but also tangents at intersecting point etcetera . You can get the angles you need there.
  • the results is 44 branches all containing a list of 1 or more intersecting points.
  • you want the ones with more then 1 point List Length + Dispatch helps selecting them
  • it is used to show the points/rooms you want + lines belonging to them.
    Giving this result:

    Lines intersection_Eef_2.gh (14.5 KB)

Dear Eef,

Thank you very much. Your assumptions indeed were right and this solution is perfect!
I notice only that there are a couple of lines that despite having also 2 intersections are not excluded.

Please, have a look in the screenshot. Why is this happening?

Please send your file. In the example I have made I cannot find anything what is explaining this.

Hi Eef,

That was a screenshot from your GH file. See one again attached here.
I can’t explain it either, your logic seems solid.

Maybe it’s a bug (problem) on my side?

No, it is not a bug problem.
It is because of the number of dots. And the placement:

  • the lines and dots curve are not anymore in 1 plane (this is because I created the surface + used the original mountain top-point (so there is a small angle what causes a small shift)
  • If you want a dot exactly on the “top” and “bottom” of the curve, you have to add some points (most easy is to divide the curve in many points and use these for the drawing, then you have "view"dots and "hotelroom"dots.
  • I made the surface as transparent as possible and zoomed in as far as possible. Now you see that in fact from the last blue dot there is a line to the mountain top (greenish). The next dot is just on other side of top and not blue.

Regards, Eef