(bug) naked / unwelded Mesh Edges not handled correct

(both systems, same behaviour: windows Rh7, mac Rh8)

something is super strange / buggy here:
a spiral-like mesh-Face-Setting.

shaded

in shaded view i would expect that the left spiral is welded at all edges (it is) and the right spiral is a real cut spiral…

showedges vs DupBoarder



looks (wrong but) consistent for this sample

but it is not, and not consistent for multiple copies: ( of the same geometry)

(left showedges, right dupBoarder)

this sample is manually drawn.
i have the same issue in a more complex geometry with this kind of mesh typology generated by code (c# plugin).
its a commercial project and i would need a fast fix or workaround @Gijs - does it make sense to additionally send a email to support ?

thanks

kind regards - tom

BadMeshEdge.3dm (3.0 MB)

this is indeed very odd. Moving the mesh makes it that some of the vertices get welded automatically, at least that’s my impression.

I’ll dig into it a little more and write up a YT

Dear @Gijs

thanks for digging in…
wait a few minutes please…

i set up a workaround yesterday and i will collect a minimal sample script.

Rhino.Geometry.Collections.MeshTopologyEdgeList.IsEdgeUnwelded

my guess: there is something wrong in the underlaying core. ;-(

ok here is a script that shows my workaround and compares it to the result of Rhino.Geometry.Collections.MeshTopologyEdgeList.IsEdgeUnwelded

(maybe i also missunderstand the meaning of this flag ?)

my workaround checks if an Edge has 2 connected Faces and if those Faces share 2 indices.

some dots are on top of each other, so MeshTopologyEdges does init some of the unwelded edges as one edge, some as two edges. (some tolerance issue from the underlaying core ?)

..for sure DupBorder and ShowEdges rely on this mechanism and behave wrong on top of this…
(and the result consist within the dot-pattern, (see the read dots compared with the yellow (dupBorder) Curve)

MeshWeldedBug.cs (2.3 KB)

hope this is helpful - as workaround for others - and for error tracking, further digging and for the devs.

hope for a fix

kind regards - tom

Unwelded does not mean naked

It might be that this behavior is unavoidable, idk. I’ve logged the issue for @piac to look into.

RH-95496 Different naked edges depending on location

I suspect the only way to keep the edges naked is to make sure the physical distance is > doc tolerance

for example, as soon as I flatten this mesh, I get the same issue back:

the docs say

IsEdgeUnwelded
Determines if the mesh edge is unwelded,
or if the mesh faces that share the edge have unique vertex indices.

… though the second condition is a bit vague…
how do you distinguish
welded
unwelded
naked
?

my workaround is doing what i expect… so i use this

yep.. though of the same test ;-D

i think the idea behind the implementation should allow for what i am after - naked edges that share an topology-edge - or at least are at the same Position / Line.

Otherwise UnweldEdge (command) does not make sense.
Same for Mesh.UnweldEdge (API)

Also - One TopologyVertex can be linked to multiple (Mesh.)Vertices - see MeshVertexIndices (API)

my guess: the implementation mixes in a buggy way:
indexA == indexB
distance < zeroTolerance
distance < geometricTolerance

welding has to do with how adjacent mesh faces are shaded:

Hi @Tom_P

maybe AlignVertices can fix the problem?

Jess

yes i know.

but the underlaying datastructure reflects this:
left - unwelded _extractPt → 32 Points
right - welded _extractPt → 8 Points

unwelded_welded_box.3dm (3.0 MB)

if you compare this box-Example with the helix i posted above - i get 2 extracted points also for edges that are not “unwelded”

and applying weldEdge or weldVertices or unweldEdge also missbehaves on the helix-Example.

thanks for having a look.
my aim is to have an unwelded edge (on the API side) - a cut out spiral …
the problem is, that the data is correct (at least at my point of view) but interpreted wrong ;-(

you can align the vertices by code:
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.collections.meshvertexlist/align

Edit: An edge is not welded and not naked if the adjacent faces use at least one different vertex which is in the exact same location of that edge. Use the MeshVertexList and not topology.

Topology vertices are sets of vertices in the MeshVertexList that can topologically be considered the same vertex.

ok i believe i got it.

box

document-Tolerance 0.001.
one CV is of by 0.00001 → it s two Typology-Edges both considered as unwelded. And as they only have one adjacent Face, there are 4 naked edges reported by showedges.

Point at (50.00000000,25.00000000,50.00000000).
Point at (50.00000000,25.00001000,50.00000000).
.............................^

spiral

my inital spiral sample shows a naked edge between the “2” (actually 4) Points:

Point 1: X=-7.5477994740063691E-15, Y=103.64784716182231, Z=0
Point 3: X=-8.3340285858820322E-15, Y=103.64784716182231, Z=0
Point 4: X=-17.38920407419057,      Y=108.01874461164527, Z=0
Point 2: X=-17.389204074190573,     Y=108.01874461164527, Z=0

but those pairs of points are of somewhere at 1.0 E-13 - considered as naked.

after aligning them (thanks @Jess ) i suspect they are identical bitwise, resulting in an unwelded edge

Point 1: X=-7.9409140299442007E-15, Y=103.64784716182231, Z=0
Point 3: X=-7.9409140299442007E-15, Y=103.64784716182231, Z=0
Point 2: X=-17.389204074190573,     Y=108.01874461164527, Z=0
Point 4: X=-17.389204074190573,     Y=108.01874461164527, Z=0

i would claim, the bug is the wrong tolerance that is applied here.

spiced up with my confusion between the special case of being naked (but being identical within document tolerance) and unwelded.

kind regards - tom

Hi Tom,
I think the problem is in the low level mesh routines. If you move your spirals away from the origin, then everything is fine:


Looks like the naked check does not calculate the actual vertex distance considering document tolerance but checks more if “is identical” based on mesh precision.

Just a guess of course and I also stumbled over that once.
Jess