TikZ custom "to path" with curved edges

Completely reimplemented and using explicit Bézier curve paths using a coordinate (passed as argument, which has a default value) to determine the curviness. Hopefully comments explain everything.

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{calc}
\tikzset{manifold/.style={to path={
  % Create new coordinates to save typing
  (\tikztostart) coordinate (@1)
  (\tikztostart |- \tikztotarget) coordinate (@2)
  (\tikztotarget) coordinate (@3)
  (\tikztostart -| \tikztotarget) coordinate (@4)
  % Get 'transformed' points
  (@1) coordinate (@@1)
  ($(@2)!0.1!(@4)$) coordinate (@@2)
  (@3) coordinate (@@3)
  ($(@4)!0.1!(@2)$) coordinate (@@4)
  % Calculate \manifoldsize for scaling
  let \p1=(@1),\p2=(@3),\n1={veclen(\x2-\x1,\y2-\y1)} in
  \pgfextra{\edef\manifoldsize{\n1}} 
  % Use coordinate passed in as #1
  let \p1=#1 in
  %
  (@@1) .. controls ++( \x1, \y1) and ++(-\x1,-\y1) .. 
  (@@2) .. controls ++( \x1,-\y1) and ++(-\x1, \y1) ..
  (@@3) .. controls ++(-\x1,-\y1) and ++( \x1, \y1) ..
  (@@4) .. controls ++(-\x1, \y1) and ++( \x1,-\y1) .. cycle (@@3)
}}, manifold/.default={(45:\manifoldsize/4)}}
\begin{document}
\begin{tikzpicture}[ultra thick, line join=round]
\draw [purple] (-2,-2) to [manifold] (5,4);
\draw [orange] (0,0) to [manifold] (3,2);
\end{tikzpicture}
\end{document}

enter image description here