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

[1.3.3] Issue with edge insertion (CDT::IntersectingConstraintEdges::Resolve) #148

Closed
egladil86 opened this issue Oct 12, 2023 · 6 comments · Fixed by #149
Closed

[1.3.3] Issue with edge insertion (CDT::IntersectingConstraintEdges::Resolve) #148

egladil86 opened this issue Oct 12, 2023 · 6 comments · Fixed by #149
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@egladil86
Copy link
Contributor

There seems to be a problem with edge insertion in [1.3.3] that worked fine in [1.3.0].

It triggers the assertion assert(triStart != noNeighbor); in Triangulation.hpp (line 1959) in Debug,
or dereferences triangles[noNeighbor] in Release.

There are two intersecting edges AB and MN.
CDT inserts the intersection point X and splits the two edges accordingly:

AB -> {AX, XB}
MN -> {MX, XN}

The problem occurs, when an edge BC (concatenating AB) is inserted,
because the previous split set m_vertTris[B] = noNeighbor (only in [1.3.3]).

I was not able to reproduce this with a minimal example.
Please find attached an example program triggering the issue:
CdtEdgeInsertIssue.zip

By default it uses [1.3.3] and crashes.
Configuring cmake with -DCDT_TAG=1.3.0 the triangulation works fine.

If this is not an code issue, but a problem with my input data, I would like to know how to determine that.

@artem-ogre
Copy link
Owner

artem-ogre commented Oct 12, 2023

Hello, @egladil86,

Thank you very much for opening the issue. Could you please format input as a text file that I could load into CDT visualizer?
You can find some examples here: https://github.com/artem-ogre/CDT/tree/master/visualizer/data

The format is

NUMBER_OF_VERTICES NUMBER_OF_EDGES
X Y # first vertex, vertex index is 0
...
X Y # last vertex
START_VERTEX_INDEX END_VERTEX_INDEX # first edge
...
START_VERTEX_INDEX END_VERTEX_INDEX # last edge

for example a single triangle is written as:

3 3
-1 0
 1 0
 0 1
0 1
1 2
2 0

@artem-ogre
Copy link
Owner

There is a chance that the bug is introduced after 1.3.0

@artem-ogre artem-ogre added bug Something isn't working good first issue Good for newcomers labels Oct 12, 2023
@egladil86
Copy link
Contributor Author

Thanks for the fast reply.
Here are the inputs in the visualizer format:
CdtEdgeInsertIssue.txt

@artem-ogre
Copy link
Owner

artem-ogre commented Oct 12, 2023

@egladil86 Could you please check the bugfix branch? Does this work for your test cases?
https://github.com/artem-ogre/CDT/tree/148-fix-bug-when-resolving-intersections

This bug was introduced as a merge error when I was rebasing a branch.
Thank you very much for spotting it and more importantly opening such an easy to work with issue. ❤️

If your tests are passing, I will merge this ASAP, make a new release.
For now I marked 1.3.3 as not ready for production.

@egladil86
Copy link
Contributor Author

@artem-ogre Yes the fix works for this and all my other testcases.
Thank you very much the fast solution.

artem-ogre added a commit that referenced this issue Oct 13, 2023
@artem-ogre artem-ogre linked a pull request Oct 13, 2023 that will close this issue
artem-ogre added a commit that referenced this issue Oct 13, 2023
@artem-ogre
Copy link
Owner

Thank you @egladil86. The fix is merged, I added you are on the contributors list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants