在顶点处绘制具有特定角度的三角形

在顶点处绘制具有特定角度的三角形

我想绘制三角形 ABC,使得 B 处的角度为 75 度。我使用\coordinate (A) at (0,0);将顶点 A 置于原点,使用\coordinate (B) at (60:6);定位顶点 B。如何在通过 A 的水平线上声明一个点 C,使得 B 处的角度为 75 度?

我将点 S 放在线段 AB 上。我想将 T 放在 BC 上,使角度 AST 为 110 度。(这涉及与定位点 C 相同的程序。)

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}

\begin{document}


\begin{tikzpicture}

\coordinate (A) at (0,0);
\coordinate (B) at (60:6);
\draw (A) -- (B);

%These commands have vertex C placed on the horizontal line through A so that angle ABC is $30^{\circ}$.
\coordinate (P) at (0,5);
\path[name path=horizontal] (A) -- (P);
%\coordintate (Q) at 

%These commands are to inscribe a triangle in $\triangle{ABC}$.
\node[circle,fill,inner sep=1.5pt,outer sep=0pt,label={left:$S$}] at ($(A)!0.75!(B)$) {};

\end{tikzpicture}
\end{document}

答案1

编辑:我稍微修改了代码,以便有更精确的角度和计算电视在 BC 边。此外,现在它使用 OP 中提供的原始 AB 边长度(即60:6)。

我使用\tkzFindAngle\tkzGetAngle(由上面的包加载tkz-euclide)向您展示角度(它们是自动计算的)。

输出

图1

代码

\documentclass[margin=10pt]{standalone}
\usepackage{amsmath,tkz-euclide}
\usepackage{tikz}
\usetkzobj{all}

\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings,shapes}

\tikzset{
    myangle/.style={fill=green!20!white, draw=green!50!black,size=.3,opacity=.3},
    intnode/.style={circle,fill=black,inner sep=1pt,outer sep=0pt}
}

\begin{document}
\begin{tikzpicture}

% Drawing the triangle and the coordinates
\draw coordinate[label=left:A] (a) --++(60:6) coordinate[label=above:B] (b);

\path[name path=ac] (a)--++(0:8.5);
\path[name path=bc] (b)--++(-45:8);
\path[name intersections={of = ac and bc, by=c}];
\node[anchor=west] at (c) {C};

\draw[use as bounding box] (a)--(b)--(c)--cycle;

% Drawing the coordinates S and T
\coordinate (s) at ($(a)!0.75!(b)$);

\path[name path=incls] (s) --++ (-10:5);
\path[name path=altbc] (b) -- (c);
\path[name intersections={of = incls and altbc, by=t}]; 

\draw[dashed] (s) -- (t) node[intnode,label={right:{\color{black}\scriptsize $T$}}] (t) {};

% Angles
\tkzFindAngle(a,b,c)
\tkzGetAngle{angleABC};
\FPround\angleABC\angleABC{0}
\tkzFindAngle(c,a,b)
\tkzGetAngle{angleCAB};
\FPround\angleCAB\angleCAB{0}
\tkzFindAngle(b,c,a)
\tkzGetAngle{angleBCA};
\FPround\angleBCA\angleBCA{0}
\tkzFindAngle(a,s,t)
\tkzGetAngle{angleAST};
\FPround\angleAST\angleAST{0}

\tkzMarkAngle[myangle](a,b,c)
\tkzLabelAngle[pos=.4](a,b,c){\tiny $\angleABC^\circ$}

\tkzMarkAngle[myangle](c,a,b)
\tkzLabelAngle[pos=0.5](c,a,b){\tiny $\angleCAB^\circ$}

\tkzMarkAngle[myangle](b,c,a)
\tkzLabelAngle[pos=0.45](b,c,a){\tiny $\angleBCA^\circ$}

\tkzMarkAngle[myangle](a,s,t)
\tkzLabelAngle[pos=0.4](a,s,t){\tiny $\angleAST^\circ$}

\node[intnode,label={left:\scriptsize $S$}] at (s) {};
\end{tikzpicture}
\end{document}

答案2

为了记录在案并供那些可能感兴趣的人来说,这里有一个使用 MetaPost 的快速方法。

我使用了 MetaPost 的标志性隐式线性方程求解器。例如,以下行

C = whatever[A, A+right] = whatever[B, A rotatedaround (B, 75)];

几乎逐字逐句地告诉 MetaPost,C 一定位于从 A 开始的水平直线上的某个位置从 B 点出发,与 (BA) 成 75 度角的直线上的某处。这足以确定 C 的确切位置。

T 的计算方式相同:

T = whatever[B, C] = whatever[S, A rotatedaround (S, 110)];

这是完整的代码,包含在LuaLaTeX程序中以方便排版。

\documentclass[border=2mm]{standalone}
\usepackage{luamplib, gensymb}
  \mplibsetformat{metafun}
  \mplibtextextlabel{enable}
\begin{document}
  \begin{mplibcode}
    pair A, B, C, S, T; numeric u;
    u = cm; A = origin; B = 6u*dir 60; S = .75[A, B];
    C = whatever[A, A+right] = whatever[B, A rotatedaround (B, 75)];
    T = whatever[B, C] = whatever[S, A rotatedaround (S, 110)];
    beginfig(1);
      draw A--B--C--cycle;
      draw S--T dashed evenly;
      label.llft("$A$", A); label.top("$B$", B); label.lrt("$C$", C);
      label.lft("$S$", S); label.urt("$T$", T);
      anglelength := 12bp;
      draw anglebetween(A--C, A--B, "$60\degree$");
      draw anglebetween(B--A, B--C, "$75\degree$");
      draw anglebetween(S--A, S--T, "$110\degree$");
    endfig;
  \end{mplibcode}
\end{document}

在此处输入图片描述

对于那些希望使用独立 MetaPost 的人来说,这里有一个合适的版本,可以产生相同的结果。

input latexmp
setupLaTeXMP(textextlabel=enable, mode=rerun, packages="gensymb");
pair A, B, C, S, T; numeric u;
u = cm; A = origin; B = 6u*dir 60; S = .75[A, B];
C = whatever[A, A+right] = whatever[B, A rotatedaround (B, 75)];
T = whatever[B, C] = whatever[S, A rotatedaround (S, 110)];
beginfig(1);
  draw A--B--C--cycle;
  draw S--T dashed evenly;
  label.llft("$A$", A); label.top("$B$", B); label.lrt("$C$", C);
  label.lft("$S$", S); label.urt("$T$", T);
  anglelength := 12bp;
  draw anglebetween(A--C, A--B, "$60\degree$");
  draw anglebetween(B--A, B--C, "$75\degree$");
  draw anglebetween(S--A, S--T, "$110\degree$");
  setbounds currentpicture to boundingbox currentpicture enlarged 2mm;
endfig;
end.

从此代码中,使用 Unix 命令行(我对 Windows 一无所知!),可以按照这些说明获取 PDF 图形,假设代码已保存在以下名称下mytriangle.mp

mpost --mem=metafun mytriangle.mp
mptopdf mytriangle.1

答案3

对于直线,我会使用intersection cs:或其隐式版本intersection of <p1>--<p2> and <p3>--<p4>

turn键对于更复杂的例子/计算很有用。

代码

\documentclass[tikz]{standalone}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}[declare function={alpha=60; beta=75; sigma=110;}]
\path (0,0) coordinate (A) + (right:1) coordinate (aC)
      (A) -- coordinate[pos=.75] (S) ++ (alpha:6) coordinate (B)
                                  ([turn]beta:-1) coordinate (bC)
      (A) -- (S) ([turn]sigma:-1) coordinate (s);

\draw (A) -- (B) -- (intersection of A--aC and B--bC) coordinate (C) -- cycle;
\draw[dashed] (S) -- (intersection of S--s and B--bC) coordinate (T);

\foreach \p/\dir in {A/180, B/90, C/0, S/alpha+90, T/45}
  \node[circle,inner sep=+1pt,fill,label=\dir:$\p$] at (\p) {};

\foreach \angle/\val in {C--A--B/alpha,          A--B--C/beta,
                         B--C--A/180-beta-alpha, A--S--T/sigma}
  \pic["\scriptsize\pgfmathparse{\val}$\pgfmathprintnumber{\pgfmathresult}^\circ$",
      draw, angle radius=7.5mm] {angle/.expanded=\angle};
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

答案4

这是另一个 TikZ 建议:

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,angles, quotes}
\begin{document}
\begin{tikzpicture}[
  dot/.style={circle,fill,inner sep=1.5pt,outer sep=0pt},
  constr/.style={overlay},% % help lines not enlarge the bounding box
  %constr/.append style={draw=red,very thick},% to show the help lines
]
%
\newcommand\dist{6}% distance A to B
\newcommand\CAB{60}% angle CAB
\newcommand\ABC{75}% angle ABC
\newcommand\AST{110}% angle AST
\newcommand\factor{3}% factor for the construction of the help lines
%
\coordinate[label=left:$A$] (A) at (0,0);
\coordinate[label=above:$B$] (B) at (\CAB:\dist);
\coordinate (S) at ($(A)!0.75!(B)$);
% C
\path[name path=horizontal,constr](A) -- ++({\factor*\dist},0);
\path[name path=leg,constr] (B) -- ++({\CAB-180+\ABC}:\factor*\dist);
\path[name intersections={of=horizontal and leg,by=C}](C)coordinate[label=right:$C$];
% T
\path[name path=st,constr] (S) -- ++({\CAB-180+\AST}:\factor*\dist);
\coordinate[name intersections={of=st and leg,by=T}];
% angles
\pic foreach \t/\a/\b/\c in {\CAB/C/A/B,\ABC/A/B/C,\AST/A/S/T}
  ["$\t^\circ$",draw=orange!80!black,angle radius=1.1cm,fill=orange!20]
  {angle=\a--\b--\c};
% triangle
\draw(A)--(B)--(C)--cycle;
\draw[blue](S)node[dot,label=left:$S$]{} -- (T)node[dot,label=right:$T$]{};
\end{tikzpicture}
\end{document}

在此处输入图片描述

这是可行的,因为角度CAB是给定的。


但可能A不在原点,或B不是由极坐标给出的。那么我们可以使用密钥,turnpgfmanual在“旋转相对坐标”小节中(在当前手册版本第 142 页):

此键的效果是局部移动坐标系,使得最后到达的点位于原点,并且坐标系被“转动”,使得 x 轴指向进入最后一点的切线方向。

H1所以我通过以下方式定义附加坐标

\path[constr](A)--(B)--([turn]{-180+\ABC}:\dist)coordinate(H1);

这意味着:从 到A然后B改变方向相对地-180°+ \ABC°(本例中为 -180+75=-105)并减去\dist(本例中​​为 18)个单位。结果角度ABH1\ABC°(本例中为 75°)。

在下面的例子中,A在,在,C 位于通过的水平线上,并且在的角度再次为 75° 和 在110°。(-2,0)B(4,5)ABS

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,angles, quotes}
\begin{document}
\begin{tikzpicture}[
  dot/.style={circle,fill,inner sep=1.5pt,outer sep=0pt},
  constr/.style={overlay},% % help lines not enlarge the bounding box
 % constr/.append style={draw=red,very thick},% to show the help lines
]
%
\newcommand\dist{18}% distance A to B
\newcommand\ABC{75}% angle ABC
\newcommand\AST{110}% angle AST
%
\coordinate[label=left:$A$] (A) at (-2,0);
\coordinate[label=above:$B$] (B) at (4,5);
\coordinate (S) at ($(A)!0.75!(B)$);
% C
\path[name path=horizontal,constr](A) -- ++(\dist,0);
\path[constr](A)--(B)--([turn]{-180+\ABC}:\dist)coordinate(H1);
\path[name path=leg,constr] (B)--(H1);
\path[name intersections={of=horizontal and leg,by=C}](C)coordinate[label=right:$C$];
% T
\path[constr](A) -- (S) -- ([turn]{-180+\AST}:\dist)coordinate(H2);
\path[name path=st,constr] (S) -- (H2);
\coordinate[name intersections={of=st and leg,by=T}];
%% angles
\pic foreach \t/\a/\b/\c in {\ABC/A/B/C,\AST/A/S/T}
  ["$\t^\circ$",draw=purple!80!black,angle radius=1.1cm,fill=purple!20]
  {angle=\a--\b--\c};
%% triangle
\draw(A)--(B)--(C)--cycle;
\draw[blue](S)node[dot,label=left:$S$]{} -- (T)node[dot,label=right:$T$]{};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容