\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{math}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=10]
%画坐标系,标刻度
\draw[->](-1,0)--(1,0) node[right,scale=2]{};
\draw[->](0,-1)--(0,1) node[above,scale=2]{};
\foreach \i/\texti in{-1,-0.5,...,1}
\draw (\i,0)--(\i,0.01) node[below=3pt]{\texti};
\foreach \i/\texti in{-1,-0.5,...,1}
\draw (0,\i)--(0.01,\i) node[right=3pt]{\texti};
%画圆,等分
\draw (0,0) circle(1);
\foreach \i in{22.5,45,...,360}
\draw [gray, fill opacity=0.2] (0:0)--(\i:1);
\foreach \i/\texti in{-22.5,0,...,112.5}
\draw [name path = line \i, green, line width = 1pt, fill opacity=0.2] (0:0)--(\i:1) node [black, fill opacity=1, right=2pt] {$s_{\texti}$};
%定义一个点A,画一条线段OA
\coordinate (O) at (0,0);
\coordinate [black,fill opacity=1, label=right:$A$] (A) at (40:1);
\draw [red, line width=4pt] (40:1) circle(0.02); %点
\draw [red, fill opacity=0.2] (O)--(A) ;
%以OA为直径画圆
\draw [name path = cir_0, dashed] (40:0.5) circle(0.5);
\path [name path = OA] (0:0) --(40:1);
%圆与各条线段的交点
\path [name intersections = {of = cir_0 and line -22.5, by = d1}];
\coordinate [label=above:$I_{1}$] (d1) at (intersection-2); %定义交点
\path [name intersections = {of = cir_0 and line 0, by = d2}];
\coordinate [label=above:$I_{2}$] (d2) at (intersection-2); %定义交点
\path [name intersections = {of = cir_0 and line 22.5, by = d3}];
\coordinate [label=above:$I_{3}$] (d3) at (intersection-1); %定义交点
\path [name intersections = {of = cir_0 and line 45, by = d4}];
\coordinate [label=above:$I_{4}$] (d4) at (intersection-1); %定义交点
\path [name intersections = {of = cir_0 and line 67.5, by = d5}];
\coordinate [label=above:$I_{5}$] (d5) at (intersection-1); %定义交点
\path [name intersections = {of = cir_0 and line 90, by = d6}];
\coordinate [label=above:$I_{6}$] (d6) at (intersection-1); %定义交点
\path [name intersections = {of = cir_0 and line 112.5, by = d7}];
\coordinate [label=above:$I_{7}$] (d7) at (intersection-2); %定义交点
\draw [red, line width=3pt] (d1) circle (0.005); %画交点
\draw [red, line width=3pt] (d2) circle (0.005); %画交点
\draw [red, line width=3pt] (d3) circle (0.005); %画交点
\draw [red, line width=3pt] (d4) circle (0.005); %画交点
\draw [red, line width=3pt] (d5) circle (0.005); %画交点
\draw [red, line width=3pt] (d6) circle (0.005); %画交点
\draw [red, line width=3pt] (d7) circle (0.005); %画交点
\draw [dashed, green, line width=1pt] (A)--(d1); %画直角边
\draw [dashed, green, line width=1pt] (A)--(d2); %画直角边
\draw [dashed, green, line width=1pt] (A)--(d3); %画直角边
\draw [dashed, green, line width=1pt] (A)--(d4); %画直角边
\draw [dashed, green, line width=1pt] (A)--(d5); %画直角边
\draw [dashed, green, line width=1pt] (A)--(d6); %画直角边
\draw [dashed, green, line width=1pt] (A)--(d7); %画直角边
%可行解
\draw [blue,dashed]
let
\p1=($(d1)-(O)$),
\n1={veclen(\x1,\y1)}
in
(O) circle (\n1);
\draw [blue,dashed]
let
\p1=($(d2)-(O)$),
\n1={veclen(\x1,\y1)}
in
(O) circle (\n1);
\draw [blue,dashed]
let
\p1=($(d3)-(O)$),
\n1={veclen(\x1,\y1)}
in
(O) circle (\n1);
\draw [blue,dashed]
let
\p1=($(d4)-(O)$),
\n1={veclen(\x1,\y1)}
in
(O) circle (\n1);
\draw [blue,dashed]
let
\p1=($(d5)-(O)$),
\n1={veclen(\x1,\y1)}
in
(O) circle (\n1);
\draw [blue,dashed]
let
\p1=($(d6)-(O)$),
\n1={veclen(\x1,\y1)}
in
(O) circle (\n1);
\draw [blue,dashed]
let
\p1=($(d7)-(O)$),
\n1={veclen(\x1,\y1)}
in
(O) circle (\n1); \end{tikzpicture}
\end{document}
tikz 标注直线与圆的交点
于 2021-12-01 18:21:12 首次发布