Skip to content
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/3251 #3280

Open
wants to merge 2 commits into
base: unstable
Choose a base branch
from
Open

Fix/3251 #3280

wants to merge 2 commits into from

Conversation

d2fong
Copy link
Member

@d2fong d2fong commented Sep 30, 2024

Cross-references to related issues. If there is no existing issue that describes your bug or feature request, then create an issue before making your pull request.

Associated issues:

Notes

  • Some progress made on the flipping bezier/non existent bezier issue
  • Mostly looking for feedback on whether this is the right direction w.r.t fixing the bezier flipping/non existent bezier issue.
  • It seems like the code producing the bug is in src/extensions/renderer/base/coord-ele-math.js specifically the findEdgeControlPoints function
Invisible bezier problem

When calculating the vector norm and vector norm inverse, it is possible for dx dy and distance (l) to be 0, leading to the norm/norm inverse to be NaN. I found another place in the edge rendering code that also mentions handling the cases of impossible beziers using a small constant value 0.01.

Flipping bezier problem

I noticed that dx and dy could be negative. Changing the computation to be absolute value changes the rendering to always make the bezier on one side. There is probably nuance to this problem that I am missing.

Testing

I temporarily edited the debug init code to be the example provided in issue #3251. Run the code by running npm run watch and toggling the various element json lines in debug/init.js

Author:

  • The proper base branch has been selected. New features go on unstable. Bug-fix patches can go on either unstable or master.
  • Automated tests have been included in this pull request, if possible, for the new feature(s) or bug fix. Check this box if tests are not pragmatically possible (e.g. rendering features could include screenshots or videos instead of automated tests).
  • The associated GitHub issues are included (above).
  • Notes have been included (above).

Reviewers:

  • All automated checks are passing (green check next to latest commit).
  • At least one reviewer has signed off on the pull request.
  • For bug fixes: Just after this pull request is merged, it should be applied to both the master branch and the unstable branch. Normally, this just requires cherry-picking the corresponding merge commit from master to unstable -- or vice versa.

@mikekucera
Copy link
Contributor

Hi Dylan,

The invisible bezier case from the test from issue #3251 is still happening for me. I took the test code posted by @anthonyhtyao and put it in an html file. The middle case with the invisible edge still happens. The flipping case is fixed. Here is the file if you want to take a look at it. Put it in the root of the project and run an http server.
test_edge_flip.html.zip

I think using small constants to avoid NaNs is a fine direction. Max would know better than me but he isn't available right now. But it looks good to me so far.

Thanks Dylan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants