GithubHelp home page GithubHelp logo

Comments (6)

captain-igloo avatar captain-igloo commented on August 30, 2024 1

Great, good work :)

from php-svg.

meyfa avatar meyfa commented on August 30, 2024

You are right, the example you gave is indeed computed incorrectly. Investigating.

from php-svg.

meyfa avatar meyfa commented on August 30, 2024

I hope to have fixed it in 97ff139. At least your example works for me now, as did some others I tried. Could you perhaps verify this as well, using the newest commit?

from php-svg.

captain-igloo avatar captain-igloo commented on August 30, 2024

I have tried a few examples and it seems to be working now. Thanks.
A small thing - how about adding a test for $sweep = true. I see line 142 is not covered by your tests currently.
Also I asked before about fmod() line 131. Since vectorAngle2() returns a number between -pi and pi (?) the fmod shouldn't be needed.
Lastly vectorAngle2() will divide by zero if $vec1x and $vec1y are both zero or if $vec2x and $vec2y are both zero.

from php-svg.

meyfa avatar meyfa commented on August 30, 2024

I added tests for all 4 combinations of LargeArc and Sweep flags (c9c2244). Also, you are right about the fmod call not being needed, I have since removed it (89bc58e).

Moreover, I considered the division by zero in vectorAngle and vectorAngle2 and came to the conclusion that the formulas provided by W3C are made to prevent this from ever becoming an issue. Entering the formulas into a computer algebra system and solving for inputs that would yield a norm of 0 gave no results. So unless I mistyped something, it won't be a problem.

The only thing that remains, then, is to implement radius scaling in case the ellipse would be too small to cover the endpoints. The algorithm is described in the W3C document as well and I will work on it now.

from php-svg.

meyfa avatar meyfa commented on August 30, 2024

Radius scaling is done (0a26b4a). Unless you can come up with further defects in SVGArcApproximator, I am going to close this issue.

from php-svg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.