我想从O
到画一条线p
。但是,看不到线。有人能解释为什么会失败吗?如果您能帮助我解决此问题,我将不胜感激。
\documentclass[12pt, a4paper]{article}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{amssymb, amsmath, amsthm}
\usepackage{tikz}
\usetikzlibrary{angles,calc,intersections,quotes}
\begin{document}
\begin{tikzpicture}
\node [below left,inner sep=1pt] {$(0,0)$};
\draw (0,-0.5) -- (0,4); %y軸
\node [circle,draw=gray] (O) at (0,1.5) [minimum size=3cm] {}; %圓
\draw [name path=x-axis] (-6,0) -- ($(-6,0)!2!(tangent cs:node=O,point={(-6,0)},solution=1)$); %x軸
\coordinate (a) at (0,3.3);
\path [name path=L] (a) -- ($(a)!8!(tangent cs:node=O,point={(a)},solution=2)$); %L
\path [name path=L'] (a) -- ($(a)!8!(tangent cs:node=O,point={(a)},solution=1)$);
\path [name intersections={of=x-axis and L, by=m}]; %(m,0)
\path [name intersections={of=x-axis and L', by=-m}]; %(-m,0)
\draw (a)--(m) node [below,inner sep=1pt] {$(m,0)$};
\draw (a)--(-m) node [below,inner sep=1pt] {$(-m,0)$};
\fill (O) circle (1pt) node [font=\scriptsize,right] at (O) {$O=(0,1)$};
\coordinate [label=above right:$p$] (p) at ($(a)!(O)!(m)$);
\fill (p) circle (1pt);
\draw (O) -- (p);
\pic [draw,angle radius=2mm] {right angle = O--p--m};
\end{tikzpicture}
\end{document}
答案1
在 中\draw (O) -- (p)
,从节点 的形状边缘(即圆)(O)
到节点 (坐标)绘制一条线(p)
。由于节点(O)
和(p)
相邻,该线退化为一个点,因此看起来好像没有绘制该线。(您可以使用\draw (O) -- (m)
来查看效果。)
通过最少的更改,您可以指定\draw[blue] (O.center) -- (p);
从节点的中心绘制(O)
到(p)
。
答案2
坐标和节点之间是有区别的——一个使用空间,另一个不使用——如果你删除注释,\draw (O)--(m);
你会看到区别
\documentclass[12pt, a4paper]{article}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{amssymb, amsmath, amsthm}
\usepackage{tikz}
\usetikzlibrary{angles,calc,intersections,quotes}
\begin{document}
\begin{tikzpicture}
\node [below left,inner sep=1pt] {$(0,0)$};
\draw (0,-0.5) -- (0,4); %y軸
\node [circle,draw=] (O) at (0,1.5) [minimum size=3cm] {}; %圓
\draw [name path=x-axis] (-6,0) -- ($(-6,0)!2!(tangent cs:node=O,point={(-6,0)},solution=1)$); %x軸
\coordinate (a) at (0,3.3);
\path [name path=L] (a) -- ($(a)!8!(tangent cs:node=O,point={(a)},solution=2)$); %L
\path [name path=L'] (a) -- ($(a)!8!(tangent cs:node=O,point={(a)},solution=1)$);
\path [name intersections={of=x-axis and L, by=m}]; %(m,0)
\path [name intersections={of=x-axis and L', by=-m}]; %(-m,0)
\draw (a)--(m) node [below,inner sep=1pt] {$(m,0)$};
\draw (a)--(-m) node [below,inner sep=1pt] {$(-m,0)$};
\fill (O) circle (1pt) node [font=\scriptsize,right] at (O) {$O=(0,1)$};
\coordinate [label=above right:$p$] (p) at ($(a)!(O)!(m)$){};
\fill (p) circle (1pt);
% \draw (O)--(m);
\draw (0,1.5)--(p);
\pic [draw,angle radius=2mm] {right angle = O--p--m};
\end{tikzpicture}
\end{document}
答案3
PSTricks 解决方案仅用于娱乐目的。
\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-eucl,pstricks-add}
\begin{document}
\begin{pspicture}(-7,-1)(7,9)
\pstGeonode
[
PointName={{(-m,0)},{(0,0)},{(m,0)},{O=(0,1)}},
PosAngle={-90,-150,-90,0},
PointNameSep={16pt,25pt,16pt,40pt},
]
(-6,0){L}(0,0){B}(6,0){R}(0,3){O}
\psCircleTangents(R)(O){3}
\pstGeonode(CircleT1){P}
\pstCircleOA{O}{B}
\pcline[nodesep=-1](L)(R)
\pcline[nodesepA=-1,nodesepB=-6](B)(O)
\pstInterLL[PointName=none,PointSymbol=none]{R}{P}{B}{O}{T}
\psline(L)(T)(R)
\psline(O)(P)
\pstRightAngle{R}{P}{O}
\end{pspicture}
\end{document}
扩展解决方案
\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-eucl,pstricks-add}
\begin{document}
\foreach \i in {1.5,1.6,...,3.5}{%
\begin{pspicture}(-7,-1)(7,11)
\pstGeonode
[
PointName={{(-m,0)},{(0,0)},{(m,0)},{O=(0,1)}},
PosAngle={-90,-150,-90,0},
PointNameSep={16pt,25pt,16pt,40pt},
]
(-6,0){L}(0,0){B}(6,0){R}(0,\i){O}
\psCircleTangents(R)(O){\i}
\pstGeonode(CircleT1){P}
\pstCircleOA{O}{B}
\pcline[nodesep=-1](L)(R)
\pcline[nodesepA=-1,nodesepB=-7](B)(O)
\pstInterLL[PointName=none,PointSymbol=none]{R}{P}{B}{O}{T}
\psline(L)(T)(R)
\psline(O)(P)
\pstRightAngle{R}{P}{O}
\end{pspicture}}
\end{document}