Divide/Trim/Redraw segment of a curve

unhandled

(Javiergonzalezcastillo 92) #1

Hello,

I have an ellipse with 2 points in the curve. How could I trim the curve between this 2 points?


(David Rutten) #2

In all likelihood an ellipse in GH is a NurbsCurve. Closed nurbs curves have seams, which is where the start and end of the curve meet. You can trim a curve to a subdomain on its interior, but that subdomain cannot include the seam.

What you will have to do to guarantee this works is adjust the seam to be on top of one of the points, then and only then figure out the closest parameters of both points and then trim the adjusted ellipse.

  1. Curve Closest Point to find the parameter for the new seam.
  2. Seam to modify the seam location.
  3. Curve Closest Point twice to find the trimming parameters on the adjusted ellipse.
  4. Sub Curve to trim to new interior domain.

But even now of course the question is whether you get the short portion of the ellipse or the long one.

Alternatively, your approach could be more like _Split instead. You get forget about seams, just find the parameters on the ellipse closest to your points, shatter your ellipse at those parameters (the Shatter component is smart enough to take seams into account), then figure out which of the two remaining elliptical segments you want to keep. The shortest? The longest? The one closest to some other point?


(Javiergonzalezcastillo 92) #3

Thank you very much. Maybe I wasn’t enough specific. What I want to get is the short segment curve of the ellipse (between the 2 points).

I am trying to did what you proposed. I post the files in case you find the solution before than me. Thanks again.Delphinarium Hall.3dm (30.8 KB)
Delphinariu Hall_Grasshopper.gh (18.9 KB)


#4

Like this ?

Delphinariu Hall_Grasshopper_r.gh (12.3 KB)