LaTeX forum ⇒ Graphics, Figures & TablesTikz (Intersect Circle and Triangle Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
coachbennett1981
Posts: 252
Joined: Fri Feb 05, 2010 10:15 pm

Tikz (Intersect Circle and Triangle

Postby coachbennett1981 » Thu May 13, 2021 1:41 pm

Hey Everyone,

I am new to using Tikz, so forgive my code as there is probably a much easier way to do this. I am trying to draw a point where segment OP and the circle intersect. Is there an easy way to do this? I am using tkz-euclid package. Here is my code:

\documentclass[border=10pt,tikz]{exam}
\usepackage{tkz-euclide}
\usepackage{amsfonts,amsmath,amssymb,tikz}
\usepackage{multicol}
\usepackage{pgfplots}
\usepackage{tcolorbox}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}

\pgfplotsset{every x tick label/.append style={font=\footnotesize, yshift=0.5ex}}
\pgfplotsset{every y tick label/.append style={font=\footnotesize, xshift=0.5ex}}
 \usepgfplotslibrary{polar}
\pagestyle{empty}
\usepackage{pgfplots}
    \pgfplotsset{compat=1.16}
    \usetikzlibrary{arrows.meta}
\begin{document}

\begin{tikzpicture}[scale=1.5]
\tkzDefPoint(0,0){A}
\tkzDefPoint(4,0){B}
\tkzDefPoint(4,3){C}
\tkzDrawSegment[color=blue,thick](A,B)
\tkzDrawSegment[color=blue,thick](B,C)
\tkzDrawSegment[color=blue,thick](A,C)
\tkzLabelSegment[right](B,C){$y$}
\tkzLabelSegment[swap](A,B){$x$}
\tkzLabelSegment[above](A,C){$r$}
\tkzMarkRightAngle(A,B,C)
\node at (5,0) [anchor=north]{$x$};
\node at (0,5)[anchor=west]{$y$};
\tkzLabelAngle[pos=.5](B,A,C){\footnotesize{\color{red}{$\theta$}}}
\tkzMarkAngle[size=0.35,mark=](B,A,C)
\draw[-latex,thin](-3,0)--(5,0);
\draw[-latex,thin](0,-1.5)--(0,5);
\node at (0,0) [anchor=east]{$O$};
\node at (4,3) [anchor=south]{$P(x,y)$};
\tkzDrawPoint(C)
\draw[color=red,thick](0,0) circle (1.5);
\end{tikzpicture}

\end{document}




Thank you for your help and time.

Bartman
Posts: 203
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Thu May 13, 2021 9:27 pm

If the point is to be drawn with commands of tkz-euclide, then you could extend your example as follows.

Apart from that I have made a few changes.

\documentclass[border=10pt]{standalone}
\usepackage{tkz-euclide}
%\usepackage{mathtools}% loads amsmath
%\usepackage{amssymb}% loads amsfonts
%\usepackage{pgfplots}

%\pgfplotsset{compat=1.17}

%\usetikzlibrary{
%  calc,angles,positioning,intersections,quotes,
%  decorations.markings,arrows.meta
%}

%\pgfplotsset{every x tick label/.append style={font=\footnotesize, yshift=0.5ex}}
%\pgfplotsset{every y tick label/.append style={font=\footnotesize, xshift=0.5ex}}
%\usepgfplotslibrary{polar}

% If you really want the y axis label to be on the right side.
% Source: tkz-base.cfg
%\tikzset{
%  ylabel style/.append style={right=3pt}
%}

\begin{document}
\begin{tikzpicture}[scale=1.5]
\tkzInit[xmin=-3,ymin=-1.5,xmax=5,ymax=5]
\tkzDrawXY[noticks]
\tkzDefPoint[label=below left:$O$](0,0){A}
\tkzDefPoint(4,0){B}
\tkzDefPoint[label={$P(x,y)$}](4,3){C}
\tkzDrawSegments[blue,thick](A,B B,C A,C)
\tkzLabelSegment[right](B,C){$y$}
\tkzLabelSegment[swap](A,B){$x$}
\tkzLabelSegment[above](A,C){$r$}
\tkzMarkRightAngle(A,B,C)
\tkzLabelAngle[pos=.5,font=\footnotesize,text=red](B,A,C){$\theta$}
\tkzMarkAngle[size=0.35,mark=none](B,A,C)
\tkzDrawPoint(C)
\tkzDrawCircle[R,red,thick](A,1.5 cm)
\tkzInterLC[R](A,C)(A,1.5 cm)
\tkzGetSecondPoint{J}
\tkzDrawPoint[label=$J$](J)
\end{tikzpicture}
\end{document}

coachbennett1981
Posts: 252
Joined: Fri Feb 05, 2010 10:15 pm

Postby coachbennett1981 » Thu May 20, 2021 4:06 pm

Thank you!!


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 11 guests