# Drawing ground in 3D using 3dplot

I want to draw ground at the specific point(0.25,0,-0.15). I am using 3dplot so the ground doesn't look aligned with the main_axis (having a little slope). How can I make the ground look aligned with the main xy,yz, or xz plane? (e.x it will look like the spiral if it is to be alligned with the yz)

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{decorations.pathmorphing,patterns}

\begin{document}

%sets the Euler matrix to use an XYZ (yaw-pitch-roll) order for the rotations.
\newcommand{\tdseteulerxyz}{
\renewcommand{\tdplotcalctransformrotmain}{%
%perform some trig for the Euler transformation
\tdplotsinandcos{\sinalpha}{\cosalpha}{\tdplotalpha}
\tdplotsinandcos{\sinbeta}{\cosbeta}{\tdplotbeta}
\tdplotsinandcos{\singamma}{\cosgamma}{\tdplotgamma}
%
\tdplotmult{\sasb}{\sinalpha}{\sinbeta}
\tdplotmult{\sasg}{\sinalpha}{\singamma}
\tdplotmult{\sasbsg}{\sasb}{\singamma}
%
\tdplotmult{\sacb}{\sinalpha}{\cosbeta}
\tdplotmult{\sacg}{\sinalpha}{\cosgamma}
\tdplotmult{\sasbcg}{\sasb}{\cosgamma}
%
\tdplotmult{\casb}{\cosalpha}{\sinbeta}
\tdplotmult{\cacb}{\cosalpha}{\cosbeta}
\tdplotmult{\cacg}{\cosalpha}{\cosgamma}
\tdplotmult{\casg}{\cosalpha}{\singamma}
%
\tdplotmult{\cbsg}{\cosbeta}{\singamma}
\tdplotmult{\cbcg}{\cosbeta}{\cosgamma}
%
\tdplotmult{\casbsg}{\casb}{\singamma}
\tdplotmult{\casbcg}{\casb}{\cosgamma}
%
%determine rotation matrix elements for Euler transformation
\pgfmathsetmacro{\raaeul}{\cacb}
\pgfmathsetmacro{\rabeul}{\casbsg - \sacg}
\pgfmathsetmacro{\raceul}{\sasg + \casbcg}
\pgfmathsetmacro{\rbaeul}{\sacb}
\pgfmathsetmacro{\rbbeul}{\sasbsg + \cacg}
\pgfmathsetmacro{\rbceul}{\sasbcg - \casg}
\pgfmathsetmacro{\rcaeul}{-\sinbeta}
\pgfmathsetmacro{\rcbeul}{\cbsg}
\pgfmathsetmacro{\rcceul}{\cbcg}
}
}

%translation for drawing spiral
\newcommand{\translatepoint}[1]%
{   \coordinate (mytranslation) at (#1);
}

\begin{tikzpicture}[scale=5,tdplot_rotated_coords,
cube/.style={very thick,black},
grid/.style={very thin,gray},
axis/.style={->,blue,thick},
spring/.style={decorate,decoration={zigzag,pre length=0.1cm,post                 length=0.1cm,segment length=3}},
rotated axis/.style={->,purple,thick}]

%draw the spiral
\translatepoint{0.25,0,0}
\begin{scope}[canvas is yz plane at x=0]
\draw [domain=0:30,variable=\t,smooth,samples=75,shift=(mytranslation), black]
plot ({\t r}: {0.00005*\t*\t});
\end{scope}

%draw ground
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.5cm,minimum height=0.2cm]
\node (ground1) at (0.25,0,-0.15) [ground, xshift=2, anchor=north] {};
\draw (ground1.north west) -- (ground1.north east);

\end{tikzpicture}
\end{document}

• Use scopes for each rotated coordinate system. – John Kormylo Apr 2 '16 at 20:51
• Welcome! And you should have a standard coordinate system, too. Otherwise, there's nothing to rotate. (I think. I'm not sure about this.) – cfr Apr 3 '16 at 3:15

Solved by addingtdplot_main_coords and canvas is yz plane at x=0 to the ground style options:
\tikzstyle{ground}=[fill,tdplot_main_coords,canvas is yz plane at x=0, pattern=north east lines,draw=none,minimum width=0.5cm,minimum height=0.2cm]