在直角坐标中指定一些点,在极坐标中指定其他点

在直角坐标中指定一些点,在极坐标中指定其他点

我想在笛卡尔平面上画一个内接于圆的直角三角形。在下面的代码中,画了一个半径为 3、中心为 (1,1) 的圆。画出了三角形的一条边,即斜边 - 它是通过 (1,1) 的直径,是垂直的。该直径的端点是三角形的两个顶点;它们被标记为 A 和 C。我想使用极坐标指定 B - 角度测量值为 -135 度或 -150 度。(我没有在直角坐标中指定 B 的坐标。因此,以下代码没有绘制三角形。)

我还想对显示屏进行另一项修改。垂直线\ell应以浅蓝色、浅绿色或浅灰色绘制。我记得help lines在手册中看到过一个选项。这会\ell按照我想要的方式绘制吗?

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{mathtools,systeme,array}

\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}


\begin{document}


\begin{tikzpicture}
\begin{axis}[width=3in,axis equal image,clip=false,
axis lines=middle,
xmin=-3,xmax=5,
xlabel=$x$,ylabel=$y$,
ymin=-5,ymax=5,
restrict y to domain=-5:5,
enlargelimits={abs=0.25cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]

\draw (1,1) circle (3);
\draw [fill] (1,1) circle [radius=1.5pt] node[anchor=west,font=\tiny]{$(1, \, 1)$};
\addplot [dashed,latex-latex,line width=0.5\pgflinewidth,domain=-5:5] (1,x) node [pos=0.1, anchor=north west, font=\footnotesize] {$\ell$};


\draw (axis cs:1,4) coordinate(A) node[above right]{$A$};
%\draw (axis cs:) coordinate(B) node[above left]{$B$};
\draw (axis cs:1,-2) coordinate(C) node[below right]{$C$};

\end{axis}

%\draw[blue] (A) -- (B) -- (C) -- cycle;
%\tkzMarkRightAngle(A,B,C);

\end{tikzpicture}

\end{document}

答案1

tikz

\documentclass[tikz]{standalone}
%\usetikzlibrary{calc}
\def\ang{60}
\def\radius{3cm}
\def\mypoint{3}
\begin{document}
  \begin{tikzpicture}
    \draw[latex-latex,thick,gray!50] (-5,0) -- (5,0)node[right]{$x$};
    \draw[latex-latex,thick, gray!50] (0,-5) -- (0,5)node[above]{$y$};
    \begin{scope}[shift={(1,1)}]
     \draw (0,0)node[circle,inner sep=2pt, fill](o){} circle (\radius);
     \draw [dashed,latex-latex,blue] (0,5) -- node [pos=0.9, anchor=north west, font=\footnotesize] {$\ell$}
                              (0,-5);
     \coordinate [label=above right:A] (A) at (\ang:\radius);
     \coordinate [label=below left:C] (C) at (180+\ang:\radius);
     \coordinate [label=above left:B] (B)  at (\mypoint*\ang:\radius);
     \draw[blue] (A) -- (B) -- (C) -- cycle;
    \end{scope}
  \end{tikzpicture}
\end{document}

在此处输入图片描述

而且用途更广泛tkz-euclide

\documentclass[11pt,a4paper,svgnames,usenames,dvipsnames]{article}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}
\tkzDefPoint(3,-4){A}\tkzDefPoint(8,4){B}\tkzDefPoint(1,5){C}
\tkzDefMidPoint(A,B) \tkzGetPoint{O}
\tkzInterLC(C,A)(O,A) \tkzGetSecondPoint{M}
\tkzInterLC(C,B)(O,A) \tkzGetFirstPoint{N}
\tkzInterLL(B,M)(A,N) \tkzGetPoint{I}
\tkzDrawCircle[diameter](A,B)
\tkzDrawSegments(A,M B,N A,B B,M A,N)
\tkzMarkRightAngles[fill=Maroon!20](A,M,B A,N,B)
\tkzLabelPoints[below](O,A,B)
\tkzLabelPoint[above left](M){$M$}
\tkzLabelPoint[above](N){$N$}
\tkzDrawPoints[color=Maroon](O,A,B)
\end{tikzpicture}
\end{document}

在此处输入图片描述

以下是版本保留axis环境:

\documentclass[10pt]{amsart}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}


\begin{document}


\begin{tikzpicture}
\begin{axis}[axis equal,
axis lines=middle,
xmin=-3,xmax=5,
xlabel=$x$,ylabel=$y$,
ymin=-5,ymax=5,
enlargelimits={abs=0.25cm},
axis line style={draw=gray!30,latex-latex},
xtick={\empty},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot [dashed,latex-latex,line width=0.5\pgflinewidth,domain=-5:5] (1,x) node [pos=0.1, anchor=north west, font=\footnotesize] {$\ell$};

%\draw (1,3) coordinate(A) node[above right]{$A$};
%\draw (axis cs:) coordinate(B) node[above left]{$B$};
%\draw (1,-2) coordinate(C) node[below right]{$C$};

\begin{scope}[yshift=5mm,font=\footnotesize]
\draw (1,0) circle (1.5cm);
\path (1,0) -- +(80:1.5cm) coordinate(A) node[above]{$A$};
\path (1,0) -- +(260:1.5cm) coordinate(C) node[below]{$C$};
\draw [fill] (1,0) circle [radius=1.5pt] node[anchor=west,font=\tiny]{$(1, \, 1)$};
\path (1,0) -- +(135:1.5cm) coordinate(B) node[inner sep=2pt,above left]{$B$};
\draw[blue] (A) -- (B) -- (C) -- cycle;
\end{scope}
\end{axis}
\tkzMarkRightAngle(A,B,C);
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

当你在等待关于如何在圆上定义一个点的答案时,pgf这里有一个版本元帖子向您展示定义圆周上点的一种方法。

在此处输入图片描述

prologues := 3;
outputtemplate := "%j%c.eps";
newinternal degrees;
degrees := 1/45;

beginfig(1);

u = 1cm;

% axes
path xx, yy; 
xx = (left -- right) scaled 5u;
yy = (down -- up)    scaled 5u;
drawarrow xx withcolor .7 white;
drawarrow yy withcolor .7 white;
label.rt (btex $x$ etex, point 1 of xx);
label.top(btex $y$ etex, point 1 of yy);

% circle and points and line
path C; 
C = fullcircle scaled 6u shifted (1u,1u);

pair a, b, c;
a = point   80 degrees of C;
c = point -100 degrees of C;
b = point  140 degrees of C;

path ell;
ell = yy shifted (xpart center C,0);

% draw the dashed line
draw ell dashed evenly withcolor 0.8[blue,white];

% mark the right angle
draw unitsquare scaled 5 rotated angle (c-b) shifted b withcolor .7 white;

% draw the triangle
draw a -- b -- c -- cycle withcolor .67 blue;

% draw the circle (and center dot) on top
draw C; fill fullcircle scaled 3 shifted center C;

% finally label the points
label(btex $A$ etex, 1.1[center C, a]);
label(btex $C$ etex, 1.1[center C, c]);
label(btex $B$ etex, 1.1[center C, b]);
label.rt(btex $\ell$ etex, point 0.1 of ell);

endfig;
end.

答案3

axis您可以通过设置在环境内使用正常的 TikZ 坐标规范(包括极坐标)disabledatascaling。请注意,这仅在数据范围不太大时才有效。

\documentclass[10pt]{amsart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}


\begin{document}


\begin{tikzpicture}
\begin{axis}[width=3in,axis equal image,clip=false,
axis lines=middle,
xmin=-3,xmax=5,
xlabel=$x$,ylabel=$y$,
ymin=-5,ymax=5,
restrict y to domain=-5:5,
enlargelimits={abs=0.25cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west},
disabledatascaling
]

\draw (1,1) circle (3);
\draw [fill] (1,1) circle [radius=1.5pt] node[anchor=west,font=\tiny]{$(1, \, 1)$};
\addplot [densely dashed,latex-latex, blue!50,domain=-5:5] (1,x) node [pos=0.1, anchor=north west, font=\footnotesize] {$\ell$};


\draw (axis cs:1,4) coordinate(A) node[above right]{$A$};
\draw (axis cs:1,1) ++(-135:3) coordinate(B) node[below left]{$B$};
\draw (axis cs:1,-2) coordinate(C) node[below right]{$C$};

\draw [ultra thick, red, opacity=0.55, line join=round] (A) -- (B) -- (C) -- cycle;

\end{axis}
\end{tikzpicture}

\end{document}

相关内容