# Curve-Plane intersection efficiency

Hi everyone,

I am need to calculate the intersection of several planes with several curves. At the moment, I have the attached definition which does eaxtly what I want. However, this methods takes a lot of time to calculate all the intersecting points. I was wondering if any of you had any recommendation about how to improve the efficiency of this definition.

Javier

plane_intersection.gh (184.3 KB)

That is indeed quite a bunch of pointsâ€¦
Curve x plane is way longer to process than line x plane.
However it extend each segment to infinityâ€¦ But evenwith a bit of filtering it stills outrun the curve x plane component

The datatree isnâ€™t the same, do you plan on sorting everything or the actual structure out of your component was what you needed?

plane_intersection_AMA.gh (1.7 MB)

Indeed a lot of pointsâ€¦ and actually I eventually will need to increase the number of planes and lines significantly.

Wow, thats much better. Yes, I tried line-plane before with one plane only, but I got confused with the extra point due to the extended lines and wasnt sure if it was actually faster.

Regarding the structure, havent looked at it yet. but eventually will need to organize the points by the cutting planes.

Thanks a lot.

If your plane will always be oriented in the XY plane, and your curves will always be lines, you can solve for the points numerically pretty quickly. Here you first sort out which intersection planes should apply to each line (if the domain defined by the start and end point Z values of each line contains the Z value of the intersection plane, then you should solve for it on that line). Then you evaluate the Z value of each included intersection plane within the domain. So, say your line runs from 0 to 1 in its Z values (X and Y donâ€™t matter here), and the Z value of your plane is at 0.25, then you can just evaluate the line at 0.25 and youâ€™ll get your intersection points.plane_intersection_numerical.gh (197.4 KB)

1 Like

Also, this organizes the intersections by the lines, but you could adjust the data structure pretty easily to make the cut planes the driver.

Thanks for your comments! I will take a look in detail later of the definition. It is always going to be a cutting XY plane, so this may be very helpfull.

Regarding the geometry always being lines, that prompts another question. I am planning to generate thes curves/lines using twistes boxes and different components whithin Puffererfish and Box Morph. Can I assume that if the input is a line the result of a box morph will be always a line?

Thanks!

Javier

Yes, I believe that box morphing keeps input types the same (so it would relocate the start/end points of your input lines, but not add any curvature).

Hi Dave,

The definition works great and much faster, thanks. I am trying to organize the data now but cutting planes. Do you have any suggestion about how to so?