我有以下代码:
\documentclass{book}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(5,0){C}
\tkzDefPoint(0,0){B} % Define B
\tkzDefShiftPoint[B]({atan(4/3)}:3){A} % Move 3 units at the calculated angle to get A
\tkzDefSquare(B,A)\tkzGetPoints{G}{F}
\tkzDefSquare(A,C)\tkzGetPoints{K}{H}
\tkzDefSquare(C,B)\tkzGetPoints{D}{E}
\tkzFillPolygon[fill = red!50 ](A,C,K,H)
\tkzFillPolygon[fill = blue!50 ](C,B,D,E)
\tkzFillPolygon[fill = green!50](B,A,G,F)
\tkzFillPolygon[fill = orange,opacity=.5](A,B,C)
\tkzDrawPolygon[line width = 1pt](A,B,C)
\tkzDrawPolygon[line width = 1pt](A,C,K,H)
\tkzDrawPolygon[line width = 1pt](C,B,D,E)
\tkzDrawPolygon[line width = 1pt](B,A,G,F)
%\tkzDrawAltitude(D,E)(A) \tkzGetPoint{L}.
%\tkzLabelPoints(A,B,D,C,E,F,G,H,K,L)
%\tkzDrawSegments[thick]( A,E A,D B,k F,C A,L)
\end{tikzpicture}
\end{document}
我尝试使用注释行来获取点 L,但是没有任何原因或者更好的建议。
答案1
该问题在 的最后几道题中被提出。在最新版本中,随着计算和绘图的分离,一些宏已被废弃或修改。和 的tkz-euclide
区别在于后者需要计算。tkzDrawLine or tkzDrawSegment
tkzDrawAltitude
在文档中,您会发现tkzDefLine[altitude](A,B,C)
只需绘制即可。
\tkzDefLine[altitude](A,D,E) % pascal974
\tkzGetPoint{L}
\tkzDrawSegment(A,L)
或者
\tkzDefPointBy[projection=onto D--E](A)
很好(Andrey L.)
使用tkz-elements
和 lualatex
\documentclass{book}
\usepackage{tkz-euclide,tkz-elements}
\begin{document}
\begin{tkzelements}
z.B = point : new (0,0)
z.C = point : new (5,0)
z.A = point : polar (3,math.atan (4/3))
T.ABC = triangle : new (z.A,z.B,z.C)
S.AB = T.ABC.ab : square (swap)
z.G,z.F = S.AB.pd,S.AB.pc
S.AC = T.ABC.ca : square (swap)
z.K,z.H = S.AC.pd,S.AC.pc
S.BC = T.ABC.bc : square (swap)
z.D,z.E = S.BC.pd,S.BC.pc
L.DE = line : new (z.D,z.E)
z.L = L.DE : projection (z.A)
\end{tkzelements}
\begin{tikzpicture}
\tkzGetNodes
\tkzFillPolygon[fill = red!50 ](A,C,K,H)
\tkzFillPolygon[fill = blue!50 ](C,B,D,E)
\tkzFillPolygon[fill = green!50](B,A,G,F)
\tkzFillPolygon[fill = orange,opacity=.5](A,B,C)
\tkzDrawPolygons[line width = 1pt](A,B,C A,C,K,H C,B,D,E B,A,G,F)
\tkzLabelPoints[left](B,F)
\tkzLabelPoints[right](K,C)
\tkzLabelPoints[above](A,G,H)
\tkzLabelPoints(D,E,L)
\tkzDrawSegments[thick](A,E A,D B,K F,C A,L)
\end{tikzpicture}
\end{document}