Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAD->bisect node. Some glitches appear on skewed quads. Fixed. #4819

Merged
merged 2 commits into from
Dec 15, 2022

Conversation

satabol
Copy link
Collaborator

@satabol satabol commented Dec 13, 2022

Windows 11, Blender 3.3.1, Sverchok-master

Glitches on skewed quads:
image

Bisect_without_normal_update v002

Expected:

Bisect_with_normal_update v001 no_errors edited

and now it works. https://docs.blender.org/api/current/bmesh.types.html#bmesh.types.BMesh.normal_update

I think this patch has to be tested in other functions where bmesh.ops.bisect_plane used.

Test:

Bisect_2022_12_13_23_11.zip

v002.0001-0600.mp4

@satabol
Copy link
Collaborator Author

satabol commented Dec 14, 2022

In the library .update_normals is used:

def bmesh_bisect(bm, point, normal, fill):
bm.normal_update()
geom_in = bm.verts[:] + bm.edges[:] + bm.faces[:]
res = bmesh.ops.bisect_plane(
bm, geom=geom_in, dist=0.00001,
plane_co=point, plane_no=normal, use_snap_center=False,
clear_outer=True, clear_inner=False)

bit fill used an old method of filling:

if fill:
fres = bmesh.ops.edgenet_prepare(
bm, edges=[e for e in res['geom_cut'] if isinstance(e, bmesh.types.BMEdge)]
)
bmesh.ops.edgeloop_fill(bm, edges=fres['edges'])

@mifth
Copy link
Collaborator

mifth commented Dec 14, 2022

It's hard to get what's going on. I guess the problem is in NGons? Maybe if you triangulate NGons the issue will be solved?

@satabol
Copy link
Collaborator Author

satabol commented Dec 14, 2022

@mifth Good remark. Triangulation of mesh can be used as additional method to fix some errors that bisect can not calculate (self intersections, single points and other). It is good to denote it in docs (I do it later, after some tests) . I try to maximize usefulness for this node. In some tests manual bisect and bisect_plane in Sverchok has different results on same geometry. I could not understand why? And now I think this is it! (with #4817 )

@satabol
Copy link
Collaborator Author

satabol commented Dec 14, 2022

More info:

For tests with current Sverchok version: https://gist.github.com/b9d4a75befd5b82f3466317bbbb8c4c1

I spend not much time to find problem with current bisect node:
image

And try to repeat it with Blender bisect:

image

No problemo. )

If set .normal_update:

image

then Sverchok result and Blender result are equal!

@satabol satabol merged commit 13c364f into master Dec 15, 2022
@satabol satabol deleted the cad_bisect_normal_glitches branch December 15, 2022 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants