-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
What does the documentation say? How is that handled in 2D and 3D? |
There was a problem hiding this 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:
- in Triangulation::insert
ON_VERTEX
The point of thepVertex
described byf
is set top
. - in Delaunay_triangulation::insert
ON_VERTEX
The position of the vertexv
described byf
is set top
.v
is returned.
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.
In 3d and 2d:
I am trying to change dD so it behaves likes 2D/3D. |
Oops, I lost the reflex to look for the documentation in a completely different place than the code...
I searched for "insert" in the 3 rounds of reviews of Triangulation_d and didn't find anything related.
I set the PR to draft in the meantime. |
Though I would be surprised if anyone was affected negatively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Successfully tested in CGA-6.0-Ic-173 |
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 aPoint_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