0

This code:

\documentclass[tikz,border=1mm]{standalone}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}[scale=4]
        \foreach \x in {1,...,10}{
            \draw (-1+0.1*\x,1+0.1*\x) -- (1+0.1*\x,-.5+0.1*\x);
        }

        \draw[->,thick, xshift=5mm,yshift=2mm] (0,0) -- (0,0.2) node (r1) [right] {}; 
        \draw[->,thick, xshift=15mm,yshift=5mm] (0,0) -- (0,0.2) node (r1) [right] {};
    \end{tikzpicture}
\end{document}

produces the following output:

enter image description here

What do I have to do so that the arrows are orthogonal to the lines and their origin begins exactly at a line?

2

For every line "i" I added two points "Ai" and "Bi" (you can add more if you need) which can be used as starting points of vectors

\documentclass[tikz,border=1mm]{standalone}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}[scale=4]
        \foreach \x in {1,...,10}{
            \draw (-1+0.1*\x,1+0.1*\x) -- (1+0.1*\x,-.5+0.1*\x)
             coordinate[pos=.8](A\x) coordinate[pos=.7](B\x);
        }

        \draw[->,thick] (B2) -- +(0.1,0.1) node (r1) [right] {}; 
        \draw[->,thick] (A8) -- +(0.1,0.1) node (r1) [right] {};
    \end{tikzpicture}
\end{document}
2

If we could improve Salim Bou's answer a little more.

\documentclass[margin=4mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
    \begin{tikzpicture}[scale=4]
        \foreach \x in {1,...,10}{
        \pgfmathtruncatemacro{\y}{\x*100};
            \draw (-1+0.1*\x,1+0.1*\x)coordinate(\x) -- (1+0.1*\x,-.5+0.1*\x)coordinate(\y) ;}     

       \coordinate (E0) at ($ (1)!.75!(100) $);  
       \draw[-latex,red] (E0) --++ (45:0.15);

       \coordinate (E1) at ($ (3)!.25!(300) $);  
       \draw[-latex,orange] (E1) --++ (45:0.35); 

       \coordinate (E2) at ($ (5)!.8!(500) $);  
       \draw[-latex,blue] (E2) --++ (45:0.45); 

    \end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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