Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
NF: Find the closest vertex on a sphere for an input vector. #483
Thanks for the comments and suggestions.
How about the following solution? Have each of these classes have it's own (just very slightly different) implementation of this function, taking or not taking the absolute value, as needed.
I have also added a test to demonstrate that scaling by l2norm is not necessary, as long as you are not interested in the angle, but rather just in finding the index of the minimal.
Hi @arokem. The tests are a bit too tight because you only test finding an already existing point to itself. I would like to see in the future a test showing that if you add a new point that is equal to old point + tiny random shift you will still get the same point. But because this is a trivial problem and this PR is needed for other more complex PRs I believe is pointless to wait right now for extra testing on this and will go ahead and merge. Inf+!!!