Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Consider changing naming convention to indicate squared distances #171

Andlon started this conversation in Ideas
Discussion options

Just spent some time scratching my head with CollisionConstraints::compute_minimum_distance. The documentation says it returns the minimum distance, but I found this in the implementation:

// NOTE: Actually distance squared

I realize that you're basically working with squared distances throughout (although for an outside user it is not clear if this holds in all cases), but it's still very confusing that "distance", which is a very unambiguously defined term in my opinion, actually means "squared distance". In my opinion, it would reduce confusion a lot for the new users and possible contributors if squared distances were always marked as such, e.g. by using naming like compute_squared_distance, compute_distance2 or similar.

(I labeled this as "bug" as, if you take the documentation and function names at their face value, what is returned is not what the naming suggests)

You must be logged in to vote

Replies: 3 comments

Comment options

I see the confusion. Definitely at the very least the documentation for the compute_minimum_distance function needs to be updated to state the returned value is a squared distance.

I originally choose not to put the word squared in the function names to keep them short and concise, and as you said distance in the toolkit is unanimously referring to a squared distance. However, I agree this can be confusing. Let me think about how to best proceed.

You must be logged in to vote
0 replies
Comment options

Actually, one small counterpoint to the point about squared distances being unanimous: Some parameters are actually not squared, such as dhat and dmin, I believe.

You must be logged in to vote
0 replies
Comment options

Yes, you are right dhat and dmin are unsquared.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
bug Something isn't working enhancement New feature or request
2 participants
Converted from issue

This discussion was converted from issue #40 on July 06, 2025 22:06.

AltStyle によって変換されたページ (->オリジナル) /