Comments (12)
Hey @fidlip ! Thanks a ton for pointing this out! ๐ฎ๐ I got a chance to copy/paste and walk through your code snippet myself, and so far I'm thinking you've found a legit bug. ๐
I did notice that one of the 52.0
values seems to be subtracted in bezier2
, whereas it was added in bezier1
... but I've tried it both ways, and it doesn't seem to make a difference. I think it should still be finding an intersection for bezier1
, and it's not. ๐
I probably won't have time today to get to the cause of this, but I wanted to thank you and let you know that @IkeBart and I will be looking into it. ๐ต It seems like the value output by rootsAlongLine
is producing a point that is just outside the bounding box of the line segment. I'm not sure exactly why this might happen. Possibly an issue with floating point precision? ๐ฆ We'll also have to check with Bezier.js to see if @Pomax 's library has the same issue, or if we introduced it. โฐ I have a feeling it was something I messed up. ๐
from bezier.dart.
Thank a lot for reply. When I tried to debug through library code, I had similar observation... but was not able to prepare some fix to offer you some PR.
from bezier.dart.
I hit another situation:
CubicBezier bezier3 = CubicBezier([Vector2(214.5,630), Vector2(308.25,630), Vector2(368.625,492.5), Vector2(429,355)]);
List<double> intersections3 = bezier3.intersectionsWithLineSegment(Vector2(0,580), Vector2(430,580));
print("bezier3 intersections= $intersections3");
// translate 6px up
CubicBezier bezier4 = CubicBezier([Vector2(214.5,630 - 6.0), Vector2(308.25,630 - 6.0), Vector2(368.625,492.5 - 6.0), Vector2(429,355 - 6.0)]);
List<double> intersections4 = bezier4.intersectionsWithLineSegment(Vector2(0,580 - 6.0), Vector2(430,580 - 6.0));
print("bezier4 intersections= $intersections4");
// translate 6px down
CubicBezier bezier5 = CubicBezier([Vector2(214.5,630 + 6.0), Vector2(308.25,630 + 6.0), Vector2(368.625,492.5 + 6.0), Vector2(429,355 + 6.0)]);
List<double> intersections5 = bezier5.intersectionsWithLineSegment(Vector2(0,580 + 6.0), Vector2(430,580 + 6.0));
print("bezier5 intersections= $intersections5");
will print out:
bezier3 intersections= []
bezier4 intersections= [0.37197975112055826]
bezier5 intersections= [0.37197975112055826]
in case of bezier3 it should be the same intersection as in following cases bezier4 & bezier5
from bezier.dart.
Thanks again! These will make great test cases when we get a chance to sit down and find a fix. ๐งโ
from bezier.dart.
Hi Aaron, is there anything I could help you with to solve this issue?
from bezier.dart.
Hey @fidlip ! Sorry for the delay. โณ It was a busy week, and now I'm on a vacation with less down time than anticipated. ๐ I'll try to take a look at this myself tonight, and if not I'll look at it on the plane tomorrow.
from bezier.dart.
I think I might know what's going on. ๐ต Like we were saying before, it seems like the points produced by plugging the roots back into the curve are just outside the bounding box of the line segment. ๐ ๐ โโ They're outside by such a small amount, it could easily be introduced by floating point imprecision. ๐
However, I checked the algorithm against its counterpart in Bezier.js, and I noticed one thing they're doing that is subtly different, but apparently important. between
function. ๐ฎ And of course, between
relies on approximately
, which checks for approximate equality--something we're not doing. ๐คฆโโ I'm pretty sure once I add in just a little bit of fuzziness, the failing test cases will pass. ๐ป It seems my suspicions were correct--this was something I messed up. ๐ Thanks for helping me find it! ๐
from bezier.dart.
from bezier.dart.
No problem! I'm glad we were able to track it down. ๐ต ๐ Please check out the PR I already merged and the new release I made on Pub and make sure everything is in order. ๐ If it is, I think we can close this issue. ๐ Cheers! ๐ป
from bezier.dart.
Hi Aaron. Thanks a lot. I will check it out in two days and let you know.
from bezier.dart.
Hi, I tested it finally. It seems to be working. Good job! Thank you again!
from bezier.dart.
Awesome! ๐ You're very welcome. Thanks for alerting us to the bug! ๐ ๐จ
from bezier.dart.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bezier.dart.