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

Don't set the point again when reinserting the same point #8022

Merged
merged 3 commits into from
Feb 16, 2024

Conversation

mglisse
Copy link
Member

@mglisse mglisse commented Feb 7, 2024

Summary of Changes

In Triangulation and Delaunay_triangulation (but not Regular_triangulation with equal weights), if we insert a point and locate notices that there is already a vertex for this point, we call set_point to set this point again. I don't understand why we do that. In most cases it should be useless but harmless. To notice a difference, we would need a Point_d type for which 2 objects may represent the same position but differ in some way (probably include extra data like a color). But even in that case, it isn't obvious to me that using the color of the last copy of this point that gets inserted is better than the color of the first copy. If someone was using this mechanism to store the index of points, having a vertex that changes what point it represents in the middle of the construction could break some uses.

It would be nice if someone else could check the logic, not just trust me.

(I don't have any particular use for this, I only noticed it while copy-pasting insert so I could customize it)

Release Management

  • Affected package(s): Triangulation
  • License and copyright ownership: unchanged

@afabri
Copy link
Member

afabri commented Feb 8, 2024

What does the documentation say? How is that handled in 2D and 3D?

Copy link
Member

@lrineau lrineau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous behavior is the one that is documented:

That behavior seems odd. If one want to change it, first check if that was mentioned during the review, and then eventually change the documentation and publish a breaking change.

@mglisse
Copy link
Member Author

mglisse commented Feb 8, 2024

How is that handled in 2D and 3D?

In 3d and 2d:
https://doc.cgal.org/latest/Triangulation_3/classCGAL_1_1Triangulation__3.html#ad8d7a1aa3b310ba8d86ede726746fcb3
https://doc.cgal.org/latest/Triangulation_2/classCGAL_1_1Triangulation__2.html#a1025cd7e7226ccb44d82f0fb1d63ad4e

If point p coincides with an already existing vertex, this vertex is returned and the triangulation remains unchanged.

I am trying to change dD so it behaves likes 2D/3D.

@mglisse mglisse marked this pull request as draft February 8, 2024 13:15
@mglisse
Copy link
Member Author

mglisse commented Feb 8, 2024

The previous behavior is the one that is documented:

Oops, I lost the reflex to look for the documentation in a completely different place than the code...

That behavior seems odd. If one want to change it, first check if that was mentioned during the review,

I searched for "insert" in the 3 rounds of reviews of Triangulation_d and didn't find anything related.

and then eventually change the documentation and publish a breaking change.

I set the PR to draft in the meantime.

Though I would be surprised if anyone was affected negatively.
@mglisse mglisse marked this pull request as ready for review February 9, 2024 15:05
Copy link
Member

@lrineau lrineau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@MaelRL MaelRL added this to the 6.0-beta milestone Feb 15, 2024
@sloriot sloriot added Batch_1 First Batch of PRs under testing Tested and removed Under Testing Ready to be tested Batch_1 First Batch of PRs under testing labels Feb 15, 2024
@sloriot
Copy link
Member

sloriot commented Feb 16, 2024

Successfully tested in CGA-6.0-Ic-173

@lrineau lrineau added the rm only: ready for master For the release team only: that indicates that a PR is about to be merged in 'master' label Feb 16, 2024
@lrineau lrineau self-assigned this Feb 16, 2024
@lrineau lrineau merged commit 1914ba6 into CGAL:master Feb 16, 2024
9 checks passed
@lrineau lrineau removed the rm only: ready for master For the release team only: that indicates that a PR is about to be merged in 'master' label Feb 16, 2024
@lrineau lrineau deleted the Triangulation-dup_vertex-glisse branch February 16, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants