summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/2geom/doc/bezier-utils-work.txt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /src/3rdparty/2geom/doc/bezier-utils-work.txt
parentInitial commit. (diff)
downloadinkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz
inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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)