C# : Possible to sort TopologyVertices (say along X or Y)?

I would like to traverse meshes from neighbor to neighbor in some direction of choice, but is it possible to rearrange TopologyVertices to follow a different order without messing up the Mesh?

And if so, how to I rearrange the TopologyVertices with C# code?

// Rolf

That’s easy provited that you can deal with Lists of integers (conn topo vertices indices etc etc) and do the loop (use Lists intersections and some bool[ ] visited [kinda the other post of yours] to control the vertices exploited).

By re-arrange I assume that you mean: get a List of vertices and do something (maybe drainage?).

Other than that :

BTW: Post something (not a banana mesh I do hope).

I have only banana meshes. :slight_smile:

The SortEdges and ConnectedTopologyVertices stuff is OK, I’m thinking more about ordering the vertices - or faces - in “bands” or stripes around the mesh so I can traverse them in a successive order:

I do have some “slicer” stuff (pictured), but that’s not exactly what I want (and it’s a slow approach and it works with a “thickness” of the slices and…). What I want is instead is an advancing index-order so I can traverse from one vertex or face to a neighbor ditto, in a desired principal direction.

Fig 1. Clumsy slices … nah. But an ordered index list to traverse would be fine.

I guess I have to make an index map filled with TV-indices, then sort the map according to my needs and then traverse and lookup the TV index for each step. Something like that.

// Rolf

OK, do the following as practice:

Given a vertex and using solely topo vertex conn arrays (with no sort) do an open/closed indices loop (naked/clothed vertex). Classic - type int - List intersections and a bool array to keep track the visited indices.

After that modify the code: take into account something (a direction [kinda we do for drainage], a proximity to a curve, a cat and/or a dog). Then use the Method in a recursion and do your path(s). BEFORE adding things in the recursion mastermind a safe exit policy.

This type of logic is used for things like these (in this case drainage from rnd faces):



BTW: For some reason I can’t attach mp4 clips that could help you to cut the mustard (this is a new Forum issue). Obviously something changed (plus: you can’t see posts anymore with cookies off).

BTW: I hate meshes (most notably banana meshes).

It is the banana meshes which separates the little lads from the men. :sunglasses:

(But I’ll grow up one of these days, don’t worry)

And yes, a proximity check against a plane or surface can be used as a guide. My (only) half reliable mesh cutter already does that. Gotta find a way to speed it up though:

// Rolf

And this as well (CR500 MX: the notorious widow maker). Make a good life insurance and give it a try.

I actually crashed with something reminding about this one, a Yamaha 190qcm in the USA in the late seventies. A state trooper in NH thought I shouldn’t drive without a helmet and set after me with full multimedia (I was just entering a forest area) and… well, in a sharp curve I hit a qubic meter stone, but bounced back on the road where I was laying on my back where the trooper found me. I wasn’t married at the time, and no serious injury, but the bike needed some repairs.

No widows, no corpses but it was a close call. I was only a teenager, but I had a chainsaw with me on my way to work. No harm to the chainsaw either.

But the state trooper (O’brian) was nervous that he had killed me. :cowboy_hat_face:

// Rolf

You Must Try Harder: real men are sorted in 2 classes: with or without titanium add-ons in their bones (Tip: try a vintage lethal Yamaha TZ750 as well [King Kenny refused to ride for a 2nd time the thing back in the good old days]).

Get the attached. Is unfinished (on purpose) and slightly faulty (ditto). The scope is to “map” (so to speak) a curve into a mesh by searching neighbor topo vertices that yield the min angle VS the crv prox tangent (per current vertex).

Of course is pointless … but so what?

Mesh_VertexPaths_EntryLevel_V1.gh (162.5 KB)

1 Like

Okay, that was cool. Got it. Very useful. Thanks!

// Rolf

BTW: The coolest race EVER was that immortal one (King Kenny VS TZ750):

Mesh_VertexPaths_EntryLevel_V1A.gh (162.0 KB)

Not into that spectator racing stuff. My coolest race was instead trying to escape the police, crash, then literally walk home the somewhat sprained bike, ensure there were no scratches on the rock I hit with the bike, earn a 5$ fine for trying to run away from the law enforcement and finally, the judge (yes, there was a trial for trying to escape the police) wishing me a pleasant stay for the rest of my time spent in the USA.

I’ll have a look also at the V1A version. I like the approach, cool, remains to make it practically useful.

// Rolf

I’m not solely a spectator mind.

Mesh_VertexPaths_EntryLevel_V1B.gh (171.8 KB)

I really meant “drive for spectators”. :smiley:

// Rolf

Note: as I said, there’s a challenge on these things.

The continue based on the if(visited[index]) check requires something else as well. Meaning that the recursion - in some cases - terminates for no apparent reason. But … what is missingt? That’s the 1M question.

Here’s some hints (for the brave):

Mesh_VertexPaths_EntryLevel_V1C.gh (165.7 KB)

Free bonus: since you live in Sweden ( Greta Tintin Eleonora Ernman Thunberg … blah, blah) I think that a super-sports motorcycle is a no-no. But I can offer you a proper eco-friendly (and recyclable) kit for your bike (hope dies last):

1 Like

I will gladly receive the proper punishment instead, both for the momma and the daughter. PR stunts, for those who care to check it up. Shuddering. Enough said.

// Rolf