Ubuntu linux, mathematica 11.0, Intel Core i56500 3.20GHz with 8 GiB RAM; Ran over X forwarding (ssh with -XYC).
Example notebook: anything. E.g.,
(*helper function*)
MyJoin[l_, pts_] :=
If[OddQ[Length[pts]], Join[l, pts], Join[l, Reverse[pts]]]
(*the algorithm itself*)
calcCasteljau[pts_, pts2_, t_] :=
Table[pts[[i]]*(1 - t) + pts2[[i]]*t, {i, 1, Length[pts]}]
rankedCasteljau[pts_, t_, acum_] :=
If[Length[pts] == 1, MyJoin[acum, pts],
rankedCasteljau[calcCasteljau[Drop[pts, -1], Drop[pts, 1], t], t,
MyJoin[acum, pts]]]
(*overloads for the basic casteljau algorithm-*)
casteljau[pts_, t_] := rankedCasteljau[pts, t, {}]
casteljauLast[pts_, t_] := {rankedCasteljau[pts, t, {}][[-1]]}
(*drawing functions*)
showCasteljau2[pts_, ptsOrig_] :=
Show[ListPlot[pts, PlotMarkers -> Automatic], ListLinePlot[pts],
ParametricPlot[casteljauLast[ptsOrig, t], {t, 0, 1}]]
showCasteljau[pts_, t_] := showCasteljau2[casteljau[pts, t], pts]
Manipulate[
showCasteljau[{{0, 0}, {0, 1}, {1, 1}, {1, 0}, {2, 0}, {2, 1}},
t], {t, 0, 1}]
Slower response caused by the forwarding is of course anticipated. The problem is that:
that the entire screen is reformatted and rerenderred (with significant and anyway annoying changes) per every key stroke, which of course causes a lag when working with an X forwarded window. I want just to turn the formatting off so that it runs as smoothly as any normal text editor.
I do not want mathematica to tell me where my new-lines should be (e.g., any copy paste reformats the code)