¿Cómo curvar un nodo Tikz?

¿Cómo curvar un nodo Tikz?

Ésta es una pregunta muy sencilla.

¿Es posible agregar un efecto de "curva" a un nodo?

Considere un nodo rectangular simple:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[draw,minimum width=3cm,minimum height=2cm]{};
\end{tikzpicture}
\end{document}

Me gustaría curvarlo como la siguiente imagen.

ingrese la descripción de la imagen aquí

Esto debería ser aplicable a todas las formas de nodos.

Respuesta1

Esta es una posible solución a través de tikz pics. Aquí se define un marco llamado mynodecon 6 argumentos que está equipado con diferentes longitudes y curvaturas de x, y. El último es para etiqueta de texto con curva. Si no hay ningún texto, elimine la decoración de la ruta en el código.

La misma idea se puede aplicar a otras formas, por ejemplo, un triángulo, pero es posible que el código necesite algunas modificaciones. Lo que sigue son las definiciones de argumentos.

#1=color, #2=x length, #3=y height, #4=inward bend angle, #5=outward bend angle, #6=text

ingrese la descripción de la imagen aquí

Código

\documentclass[border=10pt]{standalone}%{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.text}
\tikzset{%
pics/.cd,
mynode/.style args={#1#2#3#4#5#6}{
code={\node[inner sep=0pt,outer sep=0pt] at (0,0) (a) {};
\path[fill=#1] 
(a) to[bend right=#4] ++(#2,0) -- ++(0,#3) to[bend left=#5] ++(-#2,0) -- cycle;
\path[postaction={decorate},           % remove this path if no text decoration.
         decoration={raise=-15pt,
         text along path, text={#6},
         text align={left indent ={1cm}}}] 
(a) to[bend right=#4] ++(#2,0); 
}},
}

% #1=color, #2=x length, #3=y height, #4= inward bend  angle, #5= outward bend angle, #6=text

\begin{document}
\begin{tikzpicture}
  \pic {mynode={purple}{6cm}{-1cm}{20}{10}{This is my curved text.}};
  \pic at (0,-2) {mynode={olive}{6cm}{-2cm}{30}{20}{This is my curved text.}};
  \pic at (0,-5) {mynode={blue}{6cm}{-2cm}{40}{30}{This is my curved text.}};
\end{tikzpicture}
\end{document}

información relacionada