{"id":3325,"date":"2014-04-01T01:44:58","date_gmt":"2014-04-01T09:44:58","guid":{"rendered":"http:\/\/bendwavy.org\/wp\/?p=3325"},"modified":"2018-02-24T15:55:57","modified_gmt":"2018-02-24T23:55:57","slug":"relax","status":"publish","type":"post","link":"https:\/\/bendwavy.org\/wp\/?p=3325","title":{"rendered":"relax"},"content":{"rendered":"<p><a href=\"?p=2926\">This curve-fitting thingy<\/a> is one of several projects on which I&#8217;ve made progress in rare fits over several years.  It ran into two big snags.  I haven&#8217;t found how to determine which gridpoints are within the pen-width of a blending arc; two methods that ought to work don&#8217;t.  (What would help: tutoring in drawing pictures in a MacOS display, so that I might have a better idea where they go wrong. And a pony.)<\/p>\n<p>The other snag is this: For each pair of arcs, there is an infinite family of blending arcs; how to choose the osculation points to minimize rapid changes in curvature, while meeting the gridpoint constraints?  <!--more--><\/p>\n<p>I had long thought that the Right Way would be to start with a tight-fitting path and incrementally relax it, if only I could see how to do that.  A recent sleepless night produced the germ of an answer.<\/p>\n<p>A <i>node<\/i>&rsquo;s principal fields are its coordinates in the plane, a tangent angle <i>theta<\/i> and a curvature <i>kappa<\/i>.  Start with a node for each original dot, matching its coordinates exactly; its theta and kappa are taken from the circle that touches the dot and its two neighbors.  Randomly choose a node and consider the blend-arc between its two neighbor nodes; if it fits the constraints and improves the smoothness function, replace the middle node with the arc&#8217;s nearest point to the original dot.  Repeat.<\/p>\n<p>If one circle fits the whole stroke (sequence of dots), then the above procedure will &ndash; I guess &ndash; usually converge to a circle, but is not obviously driven toward the <em>best<\/em> circle.  So instead of fitting the input dots exactly, the nodes shall be compromises among those <em>on the partial-fit circles<\/em> that best fit the dots.  Some segments of those circles are uncompromised at this stage (unless the stroke is a loop); though subject to replacement, their influence should persist and the final stroke should not deviate far from them, particularly at its endpoints.<\/p>\n<p>This scheme can surely be improved.  When the above procedure can no longer help, nodes should be inserted where theta is a multiple of &pi;\/4 (i.e. E\/NE\/N\/NW\/W\/SW\/S\/SE) and other nodes &ndash; except endpoints! &ndash; removed.  These extremal nodes can then be improved by shifting according to some other rule &ndash; which I may yet think up.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This curve-fitting thingy is one of several projects on which I&#8217;ve made progress in rare fits over several years. It ran into two big snags. I haven&#8217;t found how to determine which gridpoints are within the pen-width of a blending &hellip; <a href=\"https:\/\/bendwavy.org\/wp\/?p=3325\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72],"tags":[],"class_list":["post-3325","post","type-post","status-publish","format-standard","hentry","category-curve-fitting"],"_links":{"self":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3325"}],"version-history":[{"count":5,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3325\/revisions"}],"predecessor-version":[{"id":3504,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3325\/revisions\/3504"}],"wp:attachment":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}