summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/2geom/src/python/exact-arc-length-quad-bez.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/2geom/src/python/exact-arc-length-quad-bez.py')
-rw-r--r--src/3rdparty/2geom/src/python/exact-arc-length-quad-bez.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/3rdparty/2geom/src/python/exact-arc-length-quad-bez.py b/src/3rdparty/2geom/src/python/exact-arc-length-quad-bez.py
new file mode 100644
index 0000000..fd2f4b3
--- /dev/null
+++ b/src/3rdparty/2geom/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)
+