2

How with TikZ to draw three half-lines from one (center) point, with equal angles between each two of the half-lines?

I attach a rough drawing:

draft

The main question is how to calculate the coordinates of the end-points of the lines.

1 Answer 1

13

Use polar coordinates.

Dividing 360 by the number or your segments and using a \foreach, you don't even need to calculate your angles manually.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}       
\begin{document}
    \begin{tikzpicture}
        \node[draw, fill=cyan, ellipse, text width=4pt] (a) {};
        \draw (a) -- +(0:4cm);
        \draw (a) -- +(120:4cm);
        \draw (a) -- +(240:4cm);
    \end{tikzpicture}

    You could also use a foreach: dividing 360 by the number or segments,
    you don't even need to calculate your angles manually.

    \begin{tikzpicture}
        \node[draw, fill=cyan, ellipse, text width=4pt] (a) {};
        \pgfmathsetmacro{\myangle}{360/3}
        \foreach \i in {0,1,2}
            \draw (a) -- +(\i*\myangle:4cm);
    \end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

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