-
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
fix: repel objective on segments causes slow optimization time #613
Conversation
Codecov Report
@@ Coverage Diff @@
## main #613 +/- ##
==========================================
- Coverage 65.56% 65.38% -0.18%
==========================================
Files 39 39
Lines 6615 6633 +18
Branches 1274 1278 +4
==========================================
Hits 4337 4337
- Misses 2272 2290 +18
Partials 6 6
Continue to review full report at Codecov.
|
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.
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.
Looking at the code, the changes look good to me. Seems like the perf problem is still there (?), but I think it's good to merge as long as @hypotext and @joshpoll think these functions are better alternatives to repel
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.
overall lgtm once this change is incorporated I will approve!
Forgot @joshpoll didn't have merge permission. Done now, thanks @hsharriman! |
Description
Using
repel
to ensure that text labels are a certain distance from a segment causes optimization times of between 10-15 seconds. Based on the discussion in related issue #607, implemented 2 changes:closestPtToSeg
that ensures a given point is a certain distance away from the nearest point on a given segment. As @hypotext mentions in the issue, this is faster because it does not involve sampling the distance at multiple points of the segment. After implementing this objective, the resample time drops from 10-15 seconds to 2-6 seconds.nonDegenerateAngle
to push angles to be within a reasonable range (avoid 0 and 180-degree angles). At the moment, this is implemented with a cutoff, so any angles between 10 and 170 degrees have automatically satisfied this objective.Examples with steps to reproduce them
yarn start
npx roger watch packages/synthesizer/__tests__/congruent.sub packages/synthesizer/__tests__/euclidean.sty packages/synthesizer/__tests__/geometry.dsl
from penrose root.Checklist
yarn test
yarn docs
and there were no errors when generating the HTML siteOpen questions
This was my first time writing a new constraint, and though everything appears to be working properly I'd definitely appreciate feedback on the implementation.
Questions that require more discussion or to be addressed in future development: