%lsfit.jam
(getbezierpoints) ((Touch four Bezier control points).print
.touch dot 2 .copy .setcp .touch 2 .copy .drawto .touch 2 .copy .drawto .touch 2 .copy .drawto).cvx .def
(cub) (.lsamples .lunit .lcubicbasis .lsolve .lresults).cvx .def
(cubpiece) (.lsamples .lunit .lcubicpiecebasis .lsolve .lresults).cvx .def
(par) (.lsamples .lunit .lparabolabasis .lsolve .lresults).cvx .def
(cir) (.lsamples .langle .lcirclebasis .lsolve .lresults).cvx .def
(ell) (.lsamples .langle .lellipsebasis .lsolve .lresults).cvx .def
(smc) (.lsamples .larclen .lsmoothbasis .lsolve .lresults).cvx .def
(bsc) (.lsamples .larclen .lbsplinebasis .lsolve .lresults).cvx .def
(pointslopecurve) (.lsamples .larclen .lpointslope 2 .lfree 4 .lfree .lsolve .lresults).cvx .def
(psc) (getbezierpoints pointslopecurve).cvx .def
(ic) ((improvecurve).cvx .rept).cvx .def
(icf) ((improvecurvefast).cvx .rept).cvx .def
(improvecurve) (.ladjust (Max t change = ).print cvtempstring .print ( ).print .lsolve .lresults).cvx .def
(improvecurvefast) (.laccel (r = ).print cvtempstring .print ( Max t change = ).print cvtempstring .print ( ).print .lsolve .lresults).cvx .def
(cirsamples)
(makes samples along a circle. <number of samples> <radius> => .)
(.exch (nc) .exch .store
0 2 .copy .startsa
(mult) [ 0 3.1415926 2 .mul nc .div Complex.Exp ] .store
nc 1 .sub (mult ().cvx .arrayforall Complex.Mul 2 .copy .addsa).cvx .rept)/xdef
(epc) ((n) .countsamples .store .lsamples .larclen 1 .getz n .getz 1 .getz n .getz .lpointslope 2 .lfree 4 .lfree 3 .lfree 5 .lfree .lsolve 3 (.ladjust .lsolve).cvx .rept 5 (.laccel .lsolve).cvx .rept .lresults).cvx .def