我想要制作一个关于 cathetus 定理的图形。
这是我已经得到的:
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[scale=.5,rotate=210.8]
\tkzDefPoints{0/0/C,5/0/A,0/3/B}
\tkzLabelLine[above right](A,B){$c$}
\tkzLabelLine[below right](A,C){$b$}
\tkzLabelLine[left](B,C){$a$}
\tkzDefShiftPointCoord[C](180:3){D}
\tkzDefShiftPointCoord[C](270:5){E}
\tkzMarkRightAngle[german, size=.8](A,C,B)
\tkzLabelPoint[left](A){$A$}
\tkzLabelPoint[above](C){$C$}
\tkzLabelPoint(B){$B$}
\tkzDefSquare(A,C) \tkzFillPolygon[FireBrick!70](A,C,tkzFirstPointResult,tkzSecondPointResult) \tkzDrawPolygon(A,C,tkzFirstPointResult,tkzSecondPointResult)
\tkzDefSquare(C,B) \tkzFillPolygon[Green!70](C,B,tkzFirstPointResult,tkzSecondPointResult) \tkzDrawPolygon(C,B,tkzFirstPointResult,tkzSecondPointResult)
\tkzDefSquare(B,A) \tkzGetPoints{R}{T}
\tkzLabelLine(B,D){$a^2$}
\tkzLabelLine(A,E){$b^2$}
\tkzDrawPoints(A,B,C)
\tkzDrawPolygon[line width=1.25pt](A,B,C)
\end{tikzpicture}
\end{document}
我想要一条高度为 c 的线标记。以及 c 下方的矩形。
像这样:
答案1
下面代码中唯一新的东西是 eg,它允许您在从到 的\tkzDefPointBy[projection = onto A--B](C)
直线上定义一个点,法线通过。像往常一样,使用 eg来获取命名坐标。A
B
C
\tkzGetPoint{N}
我没有在所有矩形中添加标签,但如果您需要,只需使用与正方形相同的技术即可。
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[scale=.5,rotate=210.8]
\tkzDefPoints{0/0/C,5/0/A,0/3/B}
\tkzLabelLine[above right](A,B){$c$}
\tkzLabelLine[below right](A,C){$b$}
\tkzLabelLine[left](B,C){$a$}
\tkzDefShiftPointCoord[C](180:3){D}
\tkzDefShiftPointCoord[C](270:5){E}
\tkzMarkRightAngle[german, size=.8](A,C,B)
\tkzLabelPoint[left](A){$A$}
\tkzLabelPoint[above](C){$C$}
\tkzLabelPoint(B){$B$}
\tkzDefSquare(A,C) \tkzFillPolygon[FireBrick!70](A,C,tkzFirstPointResult,tkzSecondPointResult) \tkzDrawPolygon(A,C,tkzFirstPointResult,tkzSecondPointResult)
\tkzDefSquare(C,B) \tkzFillPolygon[Green!70](C,B,tkzFirstPointResult,tkzSecondPointResult) \tkzDrawPolygon(C,B,tkzFirstPointResult,tkzSecondPointResult)
\tkzLabelLine(B,D){$a^2$}
\tkzLabelLine(A,E){$b^2$}
\tkzDrawPoints(A,B,C)
\tkzDrawPolygon[line width=1.25pt](A,B,C)
% bottom vertices of lower square
\tkzDefSquare(B,A)
\tkzGetPoints{P}{Q}
% point on P-Q where the normal runs through C
\tkzDefPointBy[projection = onto P--Q](C)
\tkzGetPoint{M}
% same for A-B
\tkzDefPointBy[projection = onto A--B](C)
\tkzGetPoint{N}
% draw the rectangles
\tkzFillPolygon[blue!20](A,P,M,N)
\tkzDrawPolygon(A,P,M,N)
\tkzFillPolygon[red!40](B,Q,M,N)
\tkzDrawPolygon(B,Q,M,N)
\tkzDrawLine[add=0 and 0](C,N)
\end{tikzpicture}
\end{document}