-
Notifications
You must be signed in to change notification settings - Fork 5
SelectEdgeByProjectedCoordinate #11
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
Conversation
…or which the specified coordinate is closest to its perpendicular projection onto this edge.
|
What you're caclulating is not necessarily the distance to the projected point. If the projection lies outside of a line segment, the distance to the closest endpoint of the line segment (edge) is computed. The naming is somewhat misleading and probably unnecessarily complex, I guess. Why not simply |
tools/selection_tools.cpp
Outdated
| maxDeviationAngle, selectFlipped); | ||
| } | ||
|
|
||
| Edge* SelectEdgeByMinPerpendicularDistance( |
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.
As commented somewhere, this is not accurate - if the projection of the given coordinate on an edge lies outside of that edge, the distance to the closest endpoint is considered.
tools/selection_tools.cpp
Outdated
| return NULL; | ||
|
|
||
| EdgeIterator iter = grid.begin<Edge>(); | ||
| Edge* bestEdge = *iter; |
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.
maybe initialize with NULL and add a check below inside the loop:
if (bestEdge == NULL || dist < bestDist)
{...}
You could then use a for loop and avoid code duplication. You could also remove the empty-check above.
…ClosestEdge' and streamlining the code according to the suggestions made.
|
Dear Sebastian, thank you for your review -- indeed, the naming was somewhat misleading. I have applied modifications according to your suggestions streamlining the code. Best regards, |
|
Dear Martin, I'm sorry that it took so long to merge your request. Thanks for taking the time to consider my comments :) Best, |
Added function 'SelectEdgeByProjectedCoordinate' selecting the edge for which the specified coordinate is closest to its perpendicular projection onto this edge.