To give some context, I am trying to adapt the code form this post

spiral spring in tikz

The code I currently have is the following one

\tikzstyle{spring}=[snake=zigzag,thick,line before snake=0.3cm,line after  snake=0.3cm,segment length=6,segment amplitude=5,join=round]%

\begin{scope}[rotate around={-33:(10,0)}]

\draw[smooth,line width=1pt,fill=black!5] plot coordinates {(0,0)(0.0334,-0.0767)(0.1087,-0.1437)(0.2253,-0.2011)(0.3824,-0.2489)(0.5790,-0.2870)(0.8139,-0.3158)(1.0860,-0.3355)(1.3940,-0.3466)(1.7365,-0.3497)(2.1123,-0.3457)(2.5199,-0.3356) (2.9580,-0.3209)(3.4252,-0.3029)(3.9198,-0.2835)(4.4427,-0.2625)(4.9936,-0.2377)(5.5666,-0.2102)(6.1594,-0.1810)(6.7696,-0.1513)(7.3950,-0.1217)(8.0332,-0.0930)(8.6815,-0.0653)(9.3376,-0.0386)(9.9988,-0.0125)};

\draw[smooth,line width=1pt,fill=black!5] plot coordinates {(0,0)(0.0095,0.0831)(0.0624,0.1691)(0.1590,0.2574)(0.2990,0.3467)(0.4824,0.4357)(0.7085,0.5225)(0.9765,0.6050)(1.2855,0.6812)(1.6341,0.7488)(2.0206,0.8055)(2.4433,0.8492)(2.8998,0.8778)(3.3879,0.8897)(3.9049,0.8833)(4.4459,0.8592)(5.0064,0.8210)(5.5876,0.7687)(6.1870,0.7023)(6.8016,0.6219)(7.4286,0.5277)(8.0650,0.4197)(8.7080,0.2980)(9.3544,0.1623)(10.0012,0.0125)};

\draw[line width=0.5pt,dashed,dash pattern=on 4pt off 1.5pt](-1,0)--(12,0);


\begin{scope}[rotate around={-13:(10,0)}]

\draw[line width=0.5pt,dashed,dash pattern=on 4pt off 1.5pt,rotate around={13:(3,0)}](-1,0)--(8,0);

\draw[line width=0.5pt,<-](3,0) +(180:3.5cm) arc (180:193:3.5cm); %This is the line which I am concerned with
\draw(3,0) +(186.5:3.7cm) node{$\alpha$};




I would like to adapt the angle $\alpha$ to the angle in my drawing. I have already understood that the line responsible for that is the one I singled out above.

\draw[line width=0.5pt,<-](3,0) +(180:3.5cm) arc (180:193:3.5cm);

If it didn't have the $+(180:3.5cm)$ parameter, I would probably be able to handle the problem myself. However, I don't understand what the $+$ parameter does, and I am not being able to find out more about it on the existing documentation.

What changes do I need to perform in order to obtain the correct representation of the angle?


Do you like to have something this:

enter image description here

The code:

\usetikzlibrary{angles,intersections,quotes}                % <--- new

    spring/.style = {snake=zigzag, thick,line before snake=0.3cm,
                     line after snake=0.3cm, segment length=6,
                     segment amplitude=5, join=round},
      Line/.style = {line width=0.5pt,                      % <--- new
                     dashed,dash pattern=on 4pt off 1.5pt},
        MA/.style = {% My Angle                             % <--- new
                    draw, <-,
                    angle radius = 88mm,
                    angle eccentricity=1,
    \begin{scope}[rotate around={-33:(10,0)}]
\draw[smooth,line width=1pt,fill=black!5] plot coordinates
     {(0,0)            (0.0334,-0.0767) (0.1087,-0.1437) (0.2253,-0.2011)
      (0.3824,-0.2489) (0.5790,-0.2870) (0.8139,-0.3158) (1.0860,-0.3355)
      (1.3940,-0.3466) (1.7365,-0.3497) (2.1123,-0.3457) (2.5199,-0.3356) (2.9580,-0.3209) (3.4252,-0.3029) (3.9198,-0.2835) (4.4427,-0.2625)
      (4.9936,-0.2377) (5.5666,-0.2102) (6.1594,-0.1810) (6.7696,-0.1513)
      (7.3950,-0.1217) (8.0332,-0.0930) (8.6815,-0.0653) (9.3376,-0.0386)
     (10.0012,0.0125) (9.3544,0.1623) (8.7080,0.2980) (8.0650,0.4197)
     (7.4286,0.5277)  (6.8016,0.6219) (6.1870,0.7023) (5.5876,0.7687)
     (5.0064,0.8210)  (4.4459,0.8592) (3.9049,0.8833) (3.3879,0.8897)
     (2.8998,0.8778)  (2.4433,0.8492) (2.0206,0.8055) (1.6341,0.7488)
     (1.2855,0.6812)  (0.9765,0.6050) (0.7085,0.5225) (0.4824,0.4357)
     (0.2990,0.3467)  (0.1590,0.2574) (0.0624,0.1691) (0.0095,0.0831)   
\draw[Line,name path=L1]                               % <--- added name path
    (-1,0) coordinate (A)                               % <--- added
            -- + (13,0);

\draw[Line, name path=L2]      % <--- added name path
    (-1,1) coordinate (B)                               % <--- added
            -- + (13,0);
\coordinate [name intersections={of=L1 and L2, by=O}];  % <--- new, 
                                                        % determine origin of angle
\pic [MA,"$\alpha$"]     {angle = A--O--B};

Edit: For angle measure I suggest to use TikZ library angles. For its use you need to define three coordinates between them lie angle measure. For determine origin of angle the intersections library is used.

I now also slightly simplify your code. See, if this simplification is usable for you.

  • I'm glad to help you. I just now edit my answer: short explanation is added. I also take library and slightly optimize your original code. Happy TeX-ing! – Zarko Apr 2 '16 at 0:43

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.