adobe-webplatform / Snap.svg

The JavaScript library for modern SVG graphics.
http://snapsvg.io
Apache License 2.0
13.91k stars 1.15k forks source link

Two questions about path.js #645

Closed nblthree closed 3 years ago

nblthree commented 3 years ago

I would like to know what this function does https://github.com/adobe-webplatform/Snap.svg/blob/master/src/path.js#L219-L237 and what are the Tvalues and Cvalues and how did you get them?

ibrierley commented 3 years ago

Good question, in the absence of a reply from Dmitry for the mo, it looks related to this code here (at the bottom)...and them being Legendre-Gauss weights ? I can't pretend to understand that stuff though! Just trying to head you in the right direction.

http://processingjs.nihongoresources.com/bezierinfo/sketchsource.php?sketch=cubicGaussQuadrature at

ibrierley commented 3 years ago

I'm not sure I should ask though, why do you want to know ? :D

nblthree commented 3 years ago

@ibrierley just trying my luck on making the calculations more precise.

https://github.com/bpmn-io/path-intersection/issues/17

ibrierley commented 3 years ago

Maybe if you go to https://pomax.github.io/bezierinfo/legendre-gauss.html#n18 and rather than select n = 12 (the one Snap uses), try n = 32 for example and copy the values for wi and xi eg at https://pomax.github.io/bezierinfo/legendre-gauss.html#n32 and then change the n value in the function to 32.

I think Tvalues are abscissa and Cvalues anre weight...maybe Just guessing!

ibrierley commented 3 years ago

Or there's a function at the top of that page, and rewrite for js (there's probably solutions out there already though).

nblthree commented 3 years ago

@ibrierley thanks you are right the problem occurs only in the other library