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

karathan
  • 2,138
  • 2
  • 17
  • 32
  • 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 '13 at 08: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 '13 at 09:04
  • For lots and lots of TikZ examples, you could take a look at http://www.texample.net/. That will give you a good idea of what TikZ can do and how to do it – Jake Mar 14 '13 at 09:07
  • Yes I've seen them. But in my work there are precise patterns like what you see above.... I just want someone to show me the way :) – karathan Mar 14 '13 at 09:27
  • But that's not really how this site works. Questions are supposed to be about a concrete issue, not general "draw this for me" requests. – Jake Mar 14 '13 at 09:29
  • Certainly I agree with you. If you think my question is in this form, then I delete it. Just its my first steps to doing my own bit more complex shapes and I want a little help.So far I do all shepeds only with Jpgfdraw – karathan Mar 14 '13 at 09:38
  • @Jake Not to assume that I want to do the job for me Ι will delete the second shape. In my book I have hundreds of shapes just wanted to see if I can make the change for jpgfdraw to tikz or to PStricks – karathan Mar 14 '13 at 09:43
  • 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 '13 at 09:54
  • @JLDiaz Very useful to me. I do not know how to make a 3d mass and a 3d spring ... At least if I knew how to do these I believe the rest would be easy and I could experiment – karathan Mar 14 '13 at 10:11
  • 1
    It is not too difficult to modify my answer here to solve your problem. – kiss my armpit Mar 14 '13 at 16:41
  • @GarbageCollector is easy to make shapes at 3d; – karathan Mar 14 '13 at 16:51
  • 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. – kiss my armpit Mar 14 '13 at 16:56
  • @GarbageCollector o.k. :-) – karathan Mar 14 '13 at 16:57

1 Answers1

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

Alain Matthes
  • 95,075
  • To get the "3D look" is something easy? – karathan Mar 14 '13 at 18:19
  • I have not written "easy" but not important. For the cylinders, look at http://tex.stackexchange.com/questions/10687/cylinder-shading-with-pgf-tikz. 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" – Alain Matthes Mar 14 '13 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. – Alain Matthes Mar 14 '13 at 19:47
  • Yes I guess it is not easy ... currently experimenting with your code – karathan Mar 14 '13 at 20:25