summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/2geom/doc/bezier-utils-work.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/2geom/doc/bezier-utils-work.txt')
-rw-r--r--src/3rdparty/2geom/doc/bezier-utils-work.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/3rdparty/2geom/doc/bezier-utils-work.txt b/src/3rdparty/2geom/doc/bezier-utils-work.txt
new file mode 100644
index 0000000..8604c12
--- /dev/null
+++ b/src/3rdparty/2geom/doc/bezier-utils-work.txt
@@ -0,0 +1,34 @@
+min .5 * sum_i lensq(bez_pt(b, u[i]) - d[i])
+
+lensq(d)=dot(d, d) = d.x * d.x + d.y * d.y
+
+sum_i (f(i) + g(i)) = sum_i f(i) + sum_i g(i), so
+we can separate into x,y parts. Since they are the same, we write `z' in the below
+to mean either x or y.
+
+.5 * sum_i (bez_pt(b, u[i]) - d[i]).z^2
+
+= .5 * sum_i (B0(u[i]) * b[0] +
+ B1(u[i]) * b[1] +
+ B2(u[i]) * b[2] +
+ B3(u[i]) * b[3]
+ - d[i] ).z^2
+
+= H.
+
+Suppose that b[0,1,3] are fixed (with b[1] perhaps being calculated
+from a prior call to existing generate_bezier).
+
+d H / d b[2].z = sum_i B2(u[i]) * (bez_pt(b, u[i]) - d[i]).z
+
+Solve for dH/db[2].z==0:
+
+-sum_i B2(u[i]) B2(u[i]) * b[2].z = sum_i B2(u[i]) * (B0(u[i]) * b[0] +
+ B1(u[i]) * b[1] +
+ B3(u[i]) * b[3]
+ - d[i] ).z
+b[2].z = ((sum_i B2(u[i]) * (B0(u[i]) * b[0] +
+ B1(u[i]) * b[1] +
+ B3(u[i]) * b[3]
+ - d[i] ).z)
+ / -sum_i (B2(u[i]))^2)