I would like to know the algorithm used in path.getTotalLength() or the definition of the function as defined in any standard specification or the source code of any browser/JS interpreter, since I would like to implement it in C++ for use in an open-source vector graphics software.
Thanks
            Asked
            
        
        
            Active
            
        
            Viewed 137 times
        
    0
            
            
        
        Ravi Arora
        
- 76
 - 6
 
- 
                    Theres no algorithm in the specification. The Mozilla approach is to [flatten the path then calculate the length of the flattened path](https://searchfox.org/mozilla-central/source/gfx/2d/Path.cpp). This is C++, check the licence meets your needs. – Robert Longson May 04 '21 at 14:08
 - 
                    Here is a similar question: https://stackoverflow.com/questions/785097/how-do-i-implement-a-b%C3%A9zier-curve-in-c ... I suppose you will have to do it yourself and it will probably take weeks of coding and testing – Michael Rovinsky May 04 '21 at 14:55
 - 
                    @RobertLongson I'll have a look into that! Thanks a lot for your answers! – Ravi Arora May 05 '21 at 10:02