-
Notifications
You must be signed in to change notification settings - Fork 279
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
feat: Add a function to compute closest points #1039
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1039 +/- ##
==========================================
+ Coverage 60.81% 61.39% +0.57%
==========================================
Files 62 62
Lines 7582 7693 +111
Branches 1811 1822 +11
==========================================
+ Hits 4611 4723 +112
+ Misses 2870 2869 -1
Partials 101 101
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Deploying with Cloudflare Pages
|
Merge necessary
…to closest-point
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.
This looks good! Suggested some minor improvements, mostly comment-type items. CI wants you to run yarn format
in the monorepo root to take care of some formatting. Still, great job on this PR!!
Would also suggest filling in the "Implementation strategy and design decisions" section of the PR. I think you can just explain at a high level that you're calculating Circles one way, Rect-like shapes another, and note any shapes that aren't supported and why.
@cmumatt @joshsunshine I cleaned up this PR; do you think it's ready to merge? I haven't yet actually read through all the implementation code for calculating closest points to verify that they're correct. |
± Registry diff
📊 PerformanceKeyNote that each bar component rounds up to the nearest 100ms, so each full bar is an overestimate by up to 400ms.
Data
|
One thing I notice is that |
Also updating file extensions |
Description
This PR adds a
closestPoint
function which takes in a shape and a point, and returns the closest point on that shape to the given point.Implementation strategy and design decisions
This PR changes the type of the
clamp
function to acceptad.Num
s for all parameters, instead of requiring the bounds of the range to be fixednumber
s. The body of the function is the same.Examples with steps to reproduce them
The example in
packages/examples/src/closest-point/
plots the closest point to several basic shapes for a single query point (resampling picks new shapes and a new point):Checklist
diagrams/
folder