diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:57:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:57:42 +0000 |
commit | 61f3ab8f23f4c924d455757bf3e65f8487521b5a (patch) | |
tree | 885599a36a308f422af98616bc733a0494fe149a /src/python/exact-arc-length-quad-bez.py | |
parent | Initial commit. (diff) | |
download | lib2geom-61f3ab8f23f4c924d455757bf3e65f8487521b5a.tar.xz lib2geom-61f3ab8f23f4c924d455757bf3e65f8487521b5a.zip |
Adding upstream version 1.3.upstream/1.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/python/exact-arc-length-quad-bez.py')
-rw-r--r-- | src/python/exact-arc-length-quad-bez.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/python/exact-arc-length-quad-bez.py b/src/python/exact-arc-length-quad-bez.py new file mode 100644 index 0000000..fd2f4b3 --- /dev/null +++ b/src/python/exact-arc-length-quad-bez.py @@ -0,0 +1,16 @@ +import math + +def q(x, a, b, c): + sa = math.sqrt(a) + y = math.sqrt(a*x*x+b*x+c) + dp = 2*a*x + b + r = dp*y/(4*a) + t = abs(dp + 2*y*sa) + s = (4*a*c-b*b)/(a*sa*8) + return r+s*math.log(t) + +a = 1160390 +b = -922658 +c = 249477 +print q(1, a,b,c) - q(0,a,b,c) + |