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)

enter image description here



%sets the Euler matrix to use an XYZ (yaw-pitch-roll) order for the rotations.
    %perform some trig for the Euler transformation
    %determine rotation matrix elements for Euler transformation
    \pgfmathsetmacro{\rabeul}{\casbsg - \sacg}
    \pgfmathsetmacro{\raceul}{\sasg + \casbcg}
    \pgfmathsetmacro{\rbbeul}{\sasbsg + \cacg}
    \pgfmathsetmacro{\rbceul}{\sasbcg - \casg}

%translation for drawing spiral
{   \coordinate (mytranslation) at (#1);

cube/.style={very thick,black},
grid/.style={very thin,gray},
spring/.style={decorate,decoration={zigzag,pre length=0.1cm,post                 length=0.1cm,segment length=3}},
rotated axis/.style={->,purple,thick}]

%draw the spiral
\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});

%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);

  • 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]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.