Monday 27 May 2013

draw snake around the rectangular node

I want to draw the "coiled snake " around the rectangle named "Obstacle". The rectangle consist of node "O". I could not figure it out as I am new to tikz. can anyone give me good suggestion in this? Thanks in Advance
Here is the code
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{snakes}
\begin{document}

\begin{tikzpicture}
\tikzstyle{block} = [draw,rounded corners,thin,fill= gray!20,  rectangle,   thick,align=center]
 % Draw axes
 % \node (0,0)(a) {$\theta$}
 \draw [<->,thick] (0,2) node (yaxis) [above] {$y$}
    |- (2,0) node (xaxis) [right] {$x$};
%\draw [gray](0,0)+(0.5,0)arc(0:45:0.5);
%\path (0,0)++ (22.5:0.7)node{$\theta$};
% Draw two intersecting lines

 \draw (1.2,1.2)coordinate(a_2);
%Draw vehicle
\draw [rotate =20](a_2)+(0.5,0)coordinate(V_c)node[block,minimum width=28,minimum height=18, rotate=20](a){};
\draw[snake=coil,](a)++(45:3)node[block,rotate=45,segment aspect=10,,minimum height=50,font =\large](O){Obstacle};

%Draw body axis
 \draw [->,rotate =20,thick] (V_c) -- ++(0,0.7)node[rotate=20](yaxis)[above]{$y_{b}$};
% \draw [->,rotate =45,thick] (V_c)++(-0.22,0.5) -- ++(0,0.7)node[rotate=45](yaxis)[above]{$v_{y}$};
  \draw [->,rotate =20,thick] (V_c) -- ++(0.8,0)node[rotate=20](yaxis)[below]{$x_{b}$};
  %draw Dimension of distance to obstacle
  \draw[dashed,rotate=45] (a.22) -- (O);
  \draw[snake=brace,raise snake=2pt,gap around snake =2pt,rotate=45] (a.22) -- (O);%for curly bracket
  \path (V_c)+(0.5,0)--coordinate(L)(O);
  \draw [rotate =45] (L)+(0.1,0.5) node[rotate=45]{$L_i$};
  \draw[->](a.10)--+(45:0.5)node[rotate=45,below]{$v$};
 \end{tikzpicture}
  \end{document}

No comments:

Post a Comment