JavaFX 9.0 SVGPath arc inaccuracy...


    JavaFX 9.0 SVGPath arc inaccuracy...


    Hi all, I've officially become desperate enough to join a forum in hopes for some advice. I'm sure this is how most developers arrive here, haha!

    We're developing a vector based graphics app using JavaFX 9.0 and making use of SVGPaths extensively. While this is quite beautiful in many ways, it fails miserable when it comes to Arcs, of all things. I've encountered a curious problem with the end of an arc being offset, if the arc length (in degree) is not on 45 degree multiples. It's perfectly precise on 0, 45, 90, 135, 180, etc....  but the end of the arc scoots forward between 0-45 with an apex at 22.5 degree and backwards between 45-90 with apex at 67.5 degree and then rinse and repeat as you go around the circle. Our numbers are correct and even using JavaFX's own Arc class works perfectly as well as my own reconstruction, using line segments. At this point I cannot imagine that we're doing anything wrong, but that there's a problem in the source code that interprets the SVGPath.


    For example: " M 0.00 -299.50 A 300.0 300.0 0 0 1 277.163859753386 -114.30502970952692 "


    I know, there's of course some numerical instability or floating point imprecision, but that does not explain or justify the offset this will produce. In this example the deviation between the end of the drawn arc and the location of the actual end point is at 0.38 degrees, Depending on the radius this can be virtually a world apart and is not acceptable. Computing the center and degrees to make a JavaFX Arc will reveal again, that all the numbers are correct and should have the end point of the arc where it was in order to produce the above numbers.


    I currently can only even think about fixing this by simply making my own line segment array, which is not a big problem, but a considerable inconvenience, of course. Not to mention that the above truly can only be describe as "A Bug". Though, I can't fully imagine it, there may be some weird thing we'd be doing wrong. That is why I'm coming to you with all this. Most of the time I am completely sure that I'm doing something wrong, haha, but I've done this often enough that I'm virtually out of such doubts by now.


    Well, any help would be appreciated! Thanks in advance!



      • 1. Re: JavaFX 9.0 SVGPath arc inaccuracy...


        unfortunately you will not get much help here.


        First do some tests with JFX 10, OpenJFX 11 and 12 to see if the issue is still present.


        If it's still there, your best shot at attempting to get a fix for this issue is to report it at Oracle's Bug or Request Feature so it may be later integrated in the OpenJDK bug system.

        The problem is that it may take months if not years for the bug to be analyzed, tested and fixed depending on what priorities are. And it's possible you may not even get a backport to JFX 9 afterwards.


        Alternatively, you may consider joining the OpenJFX (not sure what are the current instructions on how to do this nowadays) in order to provide a fix for the issue. You can also try to clone the OpenJFX repo to see if you can dig through the source code and locate what's need to be fixed. It may be an issue with the underlying renderer that may require extensive knowledge of what's been used underneath.


        Note : issues on the GitHub repo are not a replacement for submission at Oracle, actually they may not be processed at all.


        Again, any fix introduced this way may not be backported to older versions like JFX 9 as both Oracle and OpenJFX prioritize only the latest release version and the long term support version (LTS).


        Should you need a very quick fix for JFX 9, you own rendering with segments may be you best solution.