3

Following up at my previous question: let operation vs tkz-euclide

Could Tikz fans and PStricks respectively give the same shaped, as following, as to see the advantages and disadvantages of each method

The figure below is constructed through jpgfdraw. I try to give a three-dimensional perspective.

Unfortunately the jpgfdraw its fails to gradient paint. Τhe issue of gradient, I raised to this question Jpgfdraw and transparency problems

Of course Ι must to show some code ... but unfortunately I do not have the knowledge to do it.

If you consider that the figure is large and complex ... I post another.

I will not weary you. I am getting at where devote my time. I read these

What are the advantages of TikZ/PGF over PSTricks?

Fundamental differences : PSTricks, TikZ/PGF and others


1ο Update:

Here is what I see on screen of jpgfdraw
The jpgfdraw file is here: https://docs.google.com/file/d/0BxaG1GVbo3S5cFRXcV9NN3lFV2s/edit?usp=sharing

enter image description here

And here is the pdf output after compiling with xelatex

enter image description here

13
  • I think this figure is indeed to complex for this purpose. I think it would also be helpful if you could explain what you mean by "advantages and disadvantages of each method". In the end, you'll have two large chunks of code, which really wouldn't tell you a lot about the two approaches.
    – Jake
    Mar 14, 2013 at 8:36
  • Yes indeed, Ι replace it with something smaller. What I mean is. Who ultimately code I could learn. I would like to see the structure. When you're alone and you learn without help there's no easy way .... just I trying to smooth corners for a while :)
    – karathan
    Mar 14, 2013 at 9:04
  • 2
    The kind of figures you posted looks more like "pstrick figures" to me. I don't have experience with pstricks, but I've seen some "laboratory equipment" made with it (see pst-labo manual which reminded me your figure. With TikZ it would be easy to produce a schematic drawing with the same meaning, but more difficult to reproduce the "3d look"
    – JLDiaz
    Mar 14, 2013 at 9:54
  • 1
    It is not too difficult to modify my answer here to solve your problem. Mar 14, 2013 at 16:41
  • 1
    Yes. It should be easy with pst-solides3d package. But I have not used the package seriously so I am not so familiar with it. Mar 14, 2013 at 16:56

1 Answer 1

3

I'm not an expert with pstricks and I'm not sure to be an expert with tikz but I can show you how to draw something like you want. I used the code that I wrote for this question.

But it's not an answer for you question because I'm not able to write the same code with pstricks. It's possible to modify the code to get the "3D look" but it's not the most important problem.

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

\newcommand{\myfig}[6]{%
\begin{scope}[xshift=#6,
             spring/.style = {decorate,
                              decoration = {aspect         = 0.5, 
                                            segment length = #1,
                                            amplitude      = 2mm,
                                            coil}}] 

\path (0,0)                            coordinate (g) 
      (0,-1cm)                         coordinate (topspring) 
      (0,#2)                           coordinate (bottomspring) 
      (bottomspring) ++(0,-.5cm)       coordinate (pt2)
                      +(0cm,-#3)       coordinate (pt3)
                      +(1.25cm,-#3)    coordinate (#5 pt3);

 \node [platform,rotate=-30,
        anchor = south] at (g)  {};
 \draw [very thick]    (-1,0)         -- (1,0);
 \draw                (topspring)     -- (g)
                      (bottomspring)  -- (pt2.north);
 \draw [spring]       (bottomspring)  -- (topspring);
 \draw [fill=black] (pt3) circle (#3) 
                          node[inner sep = 0,
                               scale     = #4,
                               text      = white]{$m$};
 \node[right=1.5*#3] at (pt3) {#5} ;
 \end{scope}
}

\begin{document}
\begin{tikzpicture}[rotate=-30,thick,
                    every node/.style = {draw      = none,
                                         inner sep = 0pt,
                                         outer sep = 0pt},
                    platform/.style   = {fill, 
                                         pattern = north east lines,
                                         minimum width  = 2cm,
                                         minimum height  =0.3cm}]
 \myfig{1mm}{-4cm}{0.1cm}{0}{A}{-2.5cm}
 \myfig{3mm}{-6cm}{0.35cm}{1.5}{B}{0cm}
 \myfig{3mm}{-10cm}{0.4cm}{1.8}{C}{2.5cm} 

\draw[dashed]  (A pt3)  +(-0.6,0)     --  +(0.6,0)
                        +(-0.6+2.5,0) -- coordinate (b1) +(0.6+2.5,0)
               (B pt3)  +(-0.6-2.5,0) -- coordinate (a2) +(0.6-2.5,0) 
               (C pt3)  +(-0.6-2.5,0) -- coordinate (b2) +(0.6-2.5,0) ;

\draw[latex-latex] (A pt3) -- node[right=0.1cm]{$\delta l_1$} (a2); 
\draw[latex-latex] (b1)    -- node[right=0.1cm]{$\delta l_2$} (b2);
\begin{scope}[rotate=30]
  \draw  (C pt3) --([xshift=3cm]C pt3) ;
  \draw  ([xshift=1cm]C pt3)  arc (0:60:1cm);
  \path  (C pt3)--++(30:1.25) node[font=\Large]{$\phi$};
\end{scope}

\draw (C pt3) --(C pt3)|-(g);
\end{tikzpicture}
\end{document}

enter image description here

4
  • To get the "3D look" is something easy?
    – karathan
    Mar 14, 2013 at 18:19
  • I have not written "easy" but not important. For the cylinders, look at tex.stackexchange.com/questions/10687/…. For the spring, it's not easy, you can modify the line width but it's not very realistic. Perhaps you can use a "double line" Mar 14, 2013 at 19:21
  • An idea is to stock the cylinder in a box and to place the box correctly. It's not easy if you are a beginner with tikz or with pstrick. Mar 14, 2013 at 19:47
  • Yes I guess it is not easy ... currently experimenting with your code
    – karathan
    Mar 14, 2013 at 20:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .