How to control label positions in tikz-euclide
You could compute a point radially outside of the circle at each point to place the node:
The label for the origin is placed at a point opposite of the (B)
node. A slightly better solution would be to compute the angle midway between (OA)
and (OC)
and place the origin label at a 180 degree offset from that.
Code:
\documentclass[tikz,border=2pt]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(2,1){O} % Defines the point at which the origin is located
\tkzGetRandPointOn[circle=center O radius 1.5cm]{A} % Gets random point of the circle with center at O and radius 1.5cm
\tkzDrawCircle(O,A) % Draws the circle
\tkzDefPointBy[rotation=center O angle 100](A) % Defines a point...
\tkzGetPoint{C} % named C
\tkzDefPointBy[rotation=center O angle 78](A) % Defines a point...
\tkzGetPoint{B} % named B
\tkzDrawPoints(O,A,B,C) % Draws dots
\tkzDrawSegments(C,B B,A A,O O,C) % Draws the segments
% compute vectors of each point form the origin
\coordinate (OA) at ($(A)-(O)$);
\coordinate (OB) at ($(B)-(O)$);
\coordinate (OC) at ($(C)-(O)$);
\node [red] at ($(O)+1.15*(OA)$) {A};
\node [red] at ($(O)+1.15*(OB)$) {B};
\node [red] at ($(O)+1.15*(OC)$) {C};
\node [red] at ($(B)-1.15*(OB)$) {O};
\end{tikzpicture}
\end{document}
I added a part of my answer in the next version of tkz-euclide
.
\tkzAutoLabelPoints needs a point called **center** and a coefficient called **with**, this number represents a percentage of the distance between the point and the center. By default it's 0.15
\documentclass[tikz,border=2pt]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\makeatletter
\pgfkeys{/@tkzautolab/.cd,
center/.store in = \tkz@center,
with/.store in = \tkz@with,
with = 0.15,
/@tkzautolab/.search also = {/tikz},
}
\def\tkzAutoLabelPoints{\pgfutil@ifnextchar[{\tkz@AutoLabelPoints}{%
\tkz@AutoLabelPoints[]}}%
\def\tkz@AutoLabelPoints[#1](#2){%
\begingroup
\pgfqkeys{/@tkzautolab}{#1}
\foreach \point in {#2}{
\path (\tkz@center) -- ($ (\point) + \tkz@with*($(\point)-(\tkz@center)$) $) node{$\point$};}
\endgroup
}%
\makeatother
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(2,1){O} % Defines the point at which the origin is located
\tkzGetRandPointOn[circle=center O radius 1.5cm]{A} % Gets random point of the circle with center at O and radius 1.5cm
\tkzDrawCircle(O,A) % Draws the circle
\tkzDefPointBy[rotation=center O angle 100](A) % Defines a point...
\tkzGetPoint{C} % named C
\tkzDefPointBy[rotation=center O angle 78](A) % Defines a point...
\tkzGetPoint{B} % named B
\tkzDrawPoints(O,A,B,C) % Draws dots
\tkzDrawSegments(C,B B,A A,O O,C) % Draws the segments
\tkzAutoLabelPoints[center=O,red](A,B,C)
\end{tikzpicture}
\end{document}
\documentclass[tikz,border=2pt]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(2,1){O} % Defines the point at which the origin is located
\tkzGetRandPointOn[circle=center O radius 1.5cm]{A} % Gets random point of the circle with center at O and radius 1.5cm
\tkzDrawCircle(O,A) % Draws the circle
\tkzDefPointBy[rotation=center O angle 100](A) % Defines a point...
\tkzGetPoint{C} % named C
\tkzDefPointBy[rotation=center O angle 78](A) % Defines a point...
\tkzGetPoint{B} % named B
\tkzDrawPoints(O,A,B,C) % Draws dots
\tkzDrawSegments(C,B B,A A,O O,C) % Draws the segments
\tkzDefBarycentricPoint(O=1,A=1,B=1,C=1)
\tkzAutoLabelPoints[center=tkzPointResult,with=.3,red](O,A,B,C)
\end{tikzpicture}
\end{document}