我做这个练习是为了找到线和平面之间的交点。
使用此代码:
\documentclass[9pt,handout]{beamer}
\usepackage{tkz-base}
\usepackage{pgf,tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}
\tkzInit[ymax=7,xmax=9]
\tkzDefPoints{1/0/A, 6/0/B, 6/5/C, 1/5/D}
\tkzDefShiftPoint[A](30:2.5){E};
\tkzDefShiftPoint[B](30:2.5){F};
\tkzDefShiftPoint[C](30:2.5){G};
\tkzDefShiftPoint[D](30:2.5){H};
%%bepalen van lijstuk [ST]
\tkzDefBarycentricPoint(A=1,D=2) \tkzGetPoint{K};
\tkzDrawPoints(K)
\tkzLabelPoints[left](K)
\tkzDefBarycentricPoint(E=1,F=-2.5) \tkzGetPoint{L};
\tkzDrawPoints(L)
\tkzLabelPoints[above](L)
\tkzDrawSegments(A,B B,C C,D D,A F,G G,H B,F D,H C,G K,L);
\tkzDrawSegments[dashed](A,E E,F E,H F,L);
\tkzDrawPolygon[fill=orange!40, opacity=.4](B,C,G,F);
%\tkzDrawPoints(A,B,C,D,E,F,G,H);
\tkzLabelPoints[above](C,D,G,H);
\tkzLabelPoints[below](A,B,E,F); \pause
%%% tekenen van het hulpvlak
\tkzDrawPolygon[color=green,thick](A,D,L); \pause
\tkzDefShiftPoint[L](90:5){K};
\tkzDrawPolygon[fill=green,opacity=0.1,thick](A,D,K,L); \pause
%%% tekenen van de snijlijn
\tkzInterLL(C,G)(D,K) \tkzGetPoint{S1};
\tkzInterLL(A,L)(B,F) \tkzGetPoint{S2};
\tkzDrawPoint[color=red,size=8,fill=red](S1);
\tkzLabelPoint[color=red,above](S1) {S$_1$}; \pause
\tkzDrawPoint[color=red,size=8,fill=red](S2);
\tkzLabelPoint[color=red,below](S2) {S$_2$}; \pause
\tkzDrawSegment[color=red,thick](S1,S2) \pause
\tkzInterLL(S1,S2)(L,D) \tkzGetPoint{S} %%%% <<<< this works fine, but is not correct
%\tkzInterLL(S1,S2)(L,K) \tkzGetPoint{S} %%%% <<<< this doesn't work fine, but is correct
\tkzDrawPoint[color=red,size=10,fill=red](S)
\tkzLabelPoints[color=red,right](S)
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
KL
正如你在我的代码中看到的,和之间的交集S1S2
不起作用。我测试了其他所有点(H、G、D、C……),但唯一不起作用的是使用 KL。奇怪的是,K 和 L 定义为
\tkzDefBarycentricPoint(A=1,D=2) \tkzGetPoint{K};
\tkzDefBarycentricPoint(E=1,F=-2.5) \tkzGetPoint{L};
我可以K
用一种简单的方式定义点,但我想知道为什么这不起作用。(错误文件说FP error: Division by zero!.
,对我来说没有意义?)
答案1
问题在于您重新定义了K
并且\tkzDefShiftPoint[L](90:5){K};
因此线(K,L)
和(S1,S2)
是平行的,所以\tkzInterLL(S1,S2)(L,K)
未定义。