如何在以下几何图形中准确地延伸(延长或生成)线段?

如何在以下几何图形中准确地延伸(延长或生成)线段?

在此处输入图片描述 直线AP必须延长直到与X中的点相交BC。延长线PX必须是虚线。

    \documentclass[11pt,a4paper]{article}
    \usepackage{blindtext}
    \usepackage{tikz}
    \usepackage{tkz-euclide}
    \usetkzobj{all}
    \begin{document}
 \begin{center}
 \begin{tikzpicture}
 \tkzDefPoint(0,0){A}
 \tkzLabelPoints[xshift=-10pt](A)
 \tkzDefPoint(12,0){B}
 \tkzLabelPoints[xshift=-10pt](B)
 \tkzDrawSegment(A,B)
 \tkzDefPoint(7,8){C}
 \tkzLabelPoints[above](C)
 \tkzDrawSegment(A,C)
 \tkzDrawSegment(B,C)
 \tkzDefPoint(5,3){P}
 \tkzLabelPoints[above](P)
  \tkzDrawPoint[color=black,size=5 mm,fill=black](P)
  \tkzDrawSegment(A,P)
  \tkzDrawSegment(B,P)
 \end{tikzpicture}
 \end{center}
 \end{document}

答案1

您可以XAP和的交BC集中找到

\tkzInterLL(A,P)(B,C) \tkzGetPoint{X}

然后你可以PX使用

\tkzDrawSegment[dashed](P,X)

    \documentclass[11pt,a4paper]{article}
    \usepackage{blindtext}
    \usepackage{tikz}
    \usepackage{tkz-euclide}
    \usetkzobj{all}
    \begin{document}
 \begin{center}
 \begin{tikzpicture}
 \tkzDefPoint(0,0){A}
 \tkzLabelPoints[xshift=-10pt](A)
 \tkzDefPoint(12,0){B}
 \tkzLabelPoints[xshift=-10pt](B)
 \tkzDrawSegment(A,B)
 \tkzDefPoint(7,8){C}
 \tkzLabelPoints[above](C)
 \tkzDrawSegment(A,C)
 \tkzDrawSegment(B,C)
 \tkzDefPoint(5,3){P}
 \tkzLabelPoints[above](P)
  \tkzDrawPoint[color=black,size=5 mm,fill=black](P)
  \tkzDrawSegment(A,P)
  \tkzDrawSegment(B,P)
\tkzInterLL(A,P)(B,C) \tkzGetPoint{X}
\tkzDrawSegment[dashed](P,X)
\tkzDrawPoint[color=black,size=5 mm,fill=black](X)
\tkzLabelPoints[above right](X)
 \end{tikzpicture}
 \end{center}
 \end{document}

答案2

使用 MetaPost 相当简单,因为它通过变量隐式计算交点whatever。它通过指令完成

X = whatever[A, P] = whatever[B, C];

这是一个典型的 MetaPost 指令,我认为是一个非常优雅的指令。

\documentclass[11pt]{standalone}
\usepackage{luamplib}
  \mplibsetformat{metafun} % provides the `enlarged` macro
  \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
  u := cm;
  pair A, B, C, P, X; A = origin; B = u*(12, 0); C = u*(7, 8); P = u*(5, 3);
  X = whatever[A, P] = whatever[B, C]; % The intersection
  draw A--B--C--cycle; draw A--P--B; draw P--X dashed evenly;
  pickup pencircle scaled 3bp; drawdot P; drawdot X;
  label.bot("$A$", A); label.bot("$B$", B);
  label.top("$C$", C); label.top("$C$", C);
  label.top("$P$", P); label.urt("$X$", X);
  % Prevents label cropping by standalone
  setbounds currentpicture to bbox currentpicture enlarged 3bp; 
endfig;
\end{mplibcode}
\end{document}

与 一起运行LuaLaTeX

在此处输入图片描述

相关内容