Select the main vertices of a curve avoiding picking the assemble ones

Hello everyone, i want to select the “main” vertices of a crv, but this crv is the border of a piece with assembles, how can i avoid picking the pts in this assembles.

I’ve tried with angles, segments lengths, closest point to the bounding rectangle, etc, I’m clueless

Thank you so much :grimacing:

I add a picture and my gh file

Select main vertices.gh (12.7 KB)

Its better to determine those beforehand. But one approach is to check points iteratively. If you compare for similar length of the vector v1 = p(i+3)-p(i) and v2=p(i+2)-p(i+1), then chances are high this is a cut-out. If you also compare the orientation of both vectors (~parallel), you can almost certainly say its one. Hope this helps…

1 Like

As Tom The Wise (implicitcly) said: it’s a question of Rules. But in Reverse Engineering Rules … well … work when they work.

Anyway, let’s talk about a simple Rule: checking segment (back/forward) lengths against some min lengths as found in a given Polyline/Curve. Say:

BTW: If we exclude the preparation Methods (various Arrays of this and that) the “core” Method is rather very simple (as shown using just one Rule ). All Collections (and Intervals) are public:

For the back/forward part … let’s inspect a demo mode of the above C# (i.e. no result) : given a Vertex index, go back/forward (acc a user defined range) using a suitable Collection and pick segments and/or vertices. If any is not valid (against, say, a Rule of Length) go to next vertex.


Obviously additional Rules can been used (like Angles, Cats, Dogs etc etc). Spot the upper right triad in the first pic (were the Rule of Length is not enough to cut the mustard).

1 Like

Thanks, I know, I erased the original piece without assembles long ago :(, and i was trying to apply any strategy to reach my goal.

I have already try an approach comparing vectors/vertices, but I was comparing consecutive points, I’ll try your suggestion.

Thank you for your help :slight_smile:

Thanks @PeterFotiadis, I’ll try to walk in that way, but it seems it will be more work than just redrawing the original, isn´t it? haha

Thanks again :slight_smile:

If you can code you’ll need 0.5 to 1++M hours (Karma is a must).

If you have a few Profiles this is a waste of time. If you have 1M … fortune favours the bold.

1 Like

because slits points move in couples (or at least I think) and -in your drawing- are always distant 1.9 (ish) units you could try CullPt (Pufferfish plugin) with CullAll and play with the tolerance

Select main vertices_Re.gh (17.7 KB)

which more or less is something like “for each point of a given curve, if another point of the same curve exists within [Tolerance] units, then delete both”

it won’t work in situations like the following:

and will for sure produce a mess if you have points that do not belong to slits but are closer than the tolerance… but I’d give it a try

2 Likes

Tip: rather try to define (good luck) what a slit (i.e. a series of 3 segments) is.

2 Likes

Wow, this worked fantastic.
Thank you so much

:sunglasses:

1 Like

I think the main problem is indeed how to distinguish a “proper” slit from an array of segments that happens to be arranged in a “slit-like” configuration, but are not a slit :slight_smile:

I would define a general case by taking into account points (Pi, Pi+1, …), vectors (Va, Vb, Vc) and segments (Sa, Sb, Sc)

the first thing I would account is geometrical features
a slit is done of straight segments, so if amplitude of each Va, Vb, Vc is different from length of respective Sa, Sb, Sc, then that is not a slit

then I would account for angles, Va and -Vc must be parallel & Va and Vb must be perpendicular

last thing, depending if the point order of the boundary is clockwise or counterclockwise, I would expect the vectors to move a certain way, for instance in this case Va is a “left turn” from the previous vector on the boundary, then Vb is a right turn from Va, Vc is a right turn again from Vb, and then from Vc to go back to the original boundary left turn (if order of points is reversed, also lefts/rights are reversed, but still this is a pattern)

about lengths, slits are more deep than wide, so Length of Sa >> Length Sb

a big help would of course come if we know for sure the width of the slit, Length of Sb

I think this would cover most cases, but of course if you have very complex boundaries then it’s a nightmare anyway :slight_smile:

1 Like

Well … as I said it’s a matter of Rules and how you can handle’m (without code that indeed could be a nightmare - general case: many slits with different widths (see my first posted Image above) + with not 100% parallel sides and not 100% 90 deg angles + this and that). This is the reason that you should test against an Interval with some tol. Like: Interval searchX = new Interval(val-tol, val+tol); .

The back/forward item value check (or checks) as captured in the C# above is the “general” way to go. It’s up to you to define one or more Rules and provide suitable data…

That said if you go forward only … you should keep track of the rejected Indices otherwise you’ll get bananas.

Anyway prior all you sould deal (and remove) with colinear vertices from the profile Polylines. Then you should check the orientation … then … blah, blah.

That said I hate Reverse Engineering (in most of cases is a waste of time … unless you provide services for matters like these)

2 Likes