假设我们有一个给定坐标的三角形 ABC。设 AD 为其高。我该如何绘制角 BCD 的角平分线?我想避免手动计算坐标。我宁愿不使用 TKZ-Euclide,因为它缺乏英文文档。
我的最小工作示例:
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,intersections}
\begin{tikzpicture}
\coordinate[label=below left:$C$](C) at (-2,0);
\coordinate[label=below right:$A$](A) at (8,0);
\coordinate[label=above left:$B$] (B) at (0,7);
\coordinate[label=above right:$D$](D) at ($(A)!(C)!(B)$);
\draw (A) -- (B) -- (C) -- cycle;
\draw (C) -- (D);
\end{tikzpicture}
答案1
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{xparse}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,intersections}
\usetikzlibrary{through}
\NewDocumentCommand{\bissectrice}{%
O{} % drawing options
mmm % bissector of mmm
m % intersection point between base and bissector
O{1}O{1}% extended drawing of the bissector
}{%
\path[name path=Bis#2#3#4] let
\p1 = ($(#2) - (#3)$),
\p2 = ($(#4) - (#3)$),
\n1 = {veclen(\x1,\y1)} ,
\n2 = {veclen(\x2,\y2)} ,
\n3 = {max(\n1,\n2)},
\p1 = ($(#3)!\n3!(#2)$),
\p2 = ($(#3)!\n3!(#4)$),
\p3 = ($(\p1) + (\p2) - (#3)$)
in
(#3) -- (\p3) ;
\path[name path = foo] (#2)--(#4) ;
\path[name intersections={of=foo and Bis#2#3#4, by=#5}] ;
\path[#1] ($(#3)!#6!(#5)$) -- ($(#5)!#7!(#3)$) ;
}
\begin{document}
\begin{tikzpicture}
\coordinate[label=below left:$C$](C) at (-2,0);
\coordinate[label=below right:$A$](A) at (8,0);
\coordinate[label=above left:$B$] (B) at (0,7);
\coordinate[label=above right:$D$](D) at ($(A)!(C)!(B)$);
\draw (A) -- (B) -- (C) -- cycle;
\draw (C) -- (D);
\bissectrice[draw,blue] {B}{C}{D}{R}[1.1]
\bissectrice[draw,dashed]{D}{B}{C}{S}
\bissectrice[draw,dashed]{C}{D}{B}{T}
\path[name intersections={of=BisBCD and BisDBC, by=O}] ;
\node [draw=red] at (O) [circle through={($(C)!(O)!(B)$)}] {};
\end{tikzpicture}
\end{document}
旧版
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,intersections}
\newcommand{\bissectrice}[6][]{%
\path[#1] let
\p1 = ($(#3)!1cm!(#2)$),
\p2 = ($(#3)!1cm!(#4)$),
\p3 = ($(\p1) + (\p2) - (#3)$)
in
($(#3)!#6!(\p3)$) -- ($(\p3)!#5!(#3)$) ;
}
\begin{document}
\begin{tikzpicture}
\coordinate[label=below left:$C$](C) at (-2,0);
\coordinate[label=below right:$A$](A) at (8,0);
\coordinate[label=above left:$B$] (B) at (0,7);
\coordinate[label=above right:$D$](D) at ($(A)!(C)!(B)$);
\draw (A) -- (B) -- (C) -- cycle;
\draw (C) -- (D);
\bissectrice[draw,red]{B}{C}{D}{1.5}{4}
\end{tikzpicture}
\end{document}
答案2
你可以这样操作tkz-euclide
:\tkzDrawBisector(B,C,D)
\documentclass{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzInit[xmin=-2,xmax=8,ymin=0,ymax=7]
\tkzClip[space=1]
\tkzDefPoint(8,0){A}
\tkzDefPoint(0,7){B}
\tkzDefPoint(-2,0){C}
\tkzDefPointBy[projection=onto A--B](C)
\tkzGetPoint{D}
\tkzDrawPolygon(A,B,C)
\tkzDrawSegment(C,D)
\tkzDrawBisector(B,C,D)
\tkzLabelPoints(A)
\tkzLabelPoints[above right](B,D)
\tkzLabelPoints[below left](C)
\end{tikzpicture}
\end{document}
答案3
内联Asymptote
版本:
% bisect.tex
%
\documentclass{article}
\usepackage[inline]{asymptote}
\usepackage{lmodern}
\begin{document}
\begin{figure}
\centering
\begin{asy}
size(7cm);
pen linePen=deepblue+1.2bp, bisectPen=orange+0.8bp;
pair A,B,C,D,E; real CAB,ACD,BCD;
C=(-2,0); A=(8,0); B=(0,7);
CAB=degrees(C-A)-degrees(B-A);
ACD=90-CAB;
D=extension(A,B,C,rotate(ACD,C)*A);
BCD=degrees(B-C)-degrees(D-C);
E=extension(A,B,C,rotate(BCD/2,C)*D);
draw(C--A--B--C--D,linePen);
draw(C--E,bisectPen);
pair[] node={A,B,C,D,E}; string nodename="ABCDE";
pair[] nodepos={
plain.E, plain.N, plain.W, plain.NE, plain.NE,
};
dot(node,UnFill);
for(int i=0;i<node.length;++i)label("$"+substr(nodename,i,1)+"$",node[i],nodepos[i]);
label("$CD\perp AB,\ \angle BCE=\angle ECD$",(A+C)/2,plain.S);
\end{asy}
\caption{Angle bisector with \texttt{Asymptote}}
\end{figure}
\end{document}
%
% To get bisect.pdf, process:
%
% pdflatex bisect.tex
% asy bisect-*.asy
% pdflatex bisect.tex
答案4
使用 MetaPost,在 LuaLaTeX 程序内部。
、draw_mark
和宏使编码比本来的要长得多,但对于生成图形来说根本不是必需的,但我认为通过相应地标记角度可以使这个角平分线图形更清晰。这些宏来自 André Heck 的精彩作品(略作简化mark_angle
)mark_right_angle
MetaPost 中的教程。André Heck 本人从MetaPost 手册,并同时对其进行改进。
\documentclass[12pt, border=2bp]{standalone}
\usepackage{luamplib}
\mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
vardef draw_mark(expr p, mark_size) =
save t, dm;
t = arctime .5arclength(p) of p;
pair dm; dm = mark_size*unitvector(direction t of p rotated 90);
draw (-.5dm -- .5dm) shifted (point t of p);
enddef;
vardef mark_angle (expr endofa, common, endofb, mark_size) =
save p, tn; tn := turningnumber(common -- endofa -- endofb -- cycle);
path p; p = (unitvector(endofa-common){(endofa-common) rotated (tn*90)}
.. unitvector(endofb-common)) scaled mark_size shifted common;
draw p; draw_mark(p, 5bp);
enddef ;
vardef mark_right_angle (expr endofa, common, endofb, mark_size) =
save tn; tn := turningnumber(common -- endofa -- endofb -- cycle);
((1, 0) -- (1, 1) -- (0, 1))
zscaled (mark_size*unitvector((1+tn)*endofa + (1-tn)*endofb - 2*common))
shifted common
enddef ;
beginfig(1);
u := cm; pair A, B, C, D, E;
A = (8u, 0); B = (0, 7u); C = (-2u, 0);
D = whatever[A, B] = whatever[C, C + (B-A) rotated 90];
draw A--B--C--cycle; draw C--D;
draw mark_right_angle(C, D, B, 2mm);
E = C + whatever*(unitvector(D-C)+unitvector(B-C)) = whatever[A,B];
draw C--E withcolor red;
mark_angle (D, C, E, 1.25cm); mark_angle (B, C, E, 1.25cm);
label.bot("$A$", A); label.lft("$B$", B); label.bot("$C$", C); label.urt("$D$", D);
endfig;
\end{mplibcode}
\end{document}