두 광선의 교차점에 라벨링

두 광선의 교차점에 라벨링

ABCD직사각형 과 두 개의 대각선에 대한 코드가 있습니다 . 나는 대각선에 수직인 인접 꼭지점 및 에서 광선을 C그리고 D두 광선의 교차점에 레이블을 지정 하고 에 수직인 선분을 P통과하는 선분을 그리 려고 합니다 .PCDCD

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,quotes,backgrounds}


\begin{document}

\begin{tikzpicture}
\coordinate (A) at (-0.5,-0.75);
\coordinate (B) at (-0.5,0.5);
\coordinate (C) at (1,0.5);
\coordinate (D) at (1,-0.75);

\path[fill=yellow] (A) -- (B) -- (C) -- (D) -- cycle;

\path (C) -- ($(C)!1.5cm!90:(A)$);
\path (D) -- ($(D)!1.5cm!-90:(B)$);

\draw[draw=red!50, line width=0.1pt, name path=ray1] (A) -- (C);
\draw[draw=red!50, line width=0.1pt, name path=ray2] (B) -- (D);

%\coordinate [name intersections={of=ray1 and vertical,by={P}}] ;

\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]below left:$A$}] at (A) {};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]above left:$B$}] at (B) {};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]above right:$C$}] at (C) {};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]below right:$D$}] at (D) {};
\end{tikzpicture}
\end{document}

답변1

이럴 수도 있습니다.

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,quotes,backgrounds}


\begin{document}

\begin{tikzpicture}
\coordinate (A) at (-0.5,-0.75);
\coordinate (B) at (-0.5,0.5);
\coordinate (C) at (1,0.5);
\coordinate (D) at (1,-0.75);

\path[fill=yellow] (A) -- (B) -- (C) -- (D) -- cycle;

\path[draw,name path=ray1] (C) -- ($(C)!1.5cm!90:(A)$);
\path[draw,name path=ray2] (D) -- ($(D)!1.5cm!-90:(B)$);

\draw[draw=red!50, line width=0.1pt] (A) -- (C);
\draw[draw=red!50, line width=0.1pt] (B) -- (D);

\coordinate [name intersections={of=ray1 and ray2,by={P}}] ;

\node[circle,fill,inner sep=1.5pt,outer sep=0pt,label={right:$P$}] at (P) {};
\draw (P) -- ($(D)!(P)!(C)$);

\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]below left:$A$}] at (A) {};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]above left:$B$}] at (B) {};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]above right:$C$}] at (C) {};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]below right:$D$}] at (D) {};
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

답변2

이 같은? 내 생각은 Harish Kumar의 것과 다르기 때문에 그가 먼저 답변했더라도 게시하겠습니다. 내 방법을 사용하면 두 번째 교차점이 원하는 것이므로 두 번째 교차점이 P가 되도록 첫 번째 교차점의 이름을 Q로 지정했습니다.

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{calc,intersections,quotes,backgrounds}

\begin{document}
  \tikzset{
    my circle/.style={outer sep=0pt, circle, fill, inner sep=1.5pt},
    my ray/.style={draw=red!50, line width=.1pt}
  }

  \begin{tikzpicture}
    \coordinate (A) at (-0.5,-0.75);
    \coordinate (B) at (-0.5,0.5);
    \coordinate (C) at (1,0.5);
    \coordinate (D) at (1,-0.75);

    \path[fill=yellow] (A) -- (B) -- (C) -- (D) -- cycle;

    \pgfmathsetmacro\myresult{atan(1.5/1.25)}
    \path [my ray, name path=ray1] (A) -- (C) -- +(-\myresult:1);
    \path [my ray, name path=ray2] (B) -- (D) -- +(\myresult:1);

    \path [name intersections={of=ray1 and ray2, by={Q,P}}] (P) node [right] {P} ;
    \draw (P) -- (C |- P);

    \node[my circle,label={[fill=white]below left:$A$}] at (A) {};
    \node[my circle,label={[fill=white]above left:$B$}] at (B) {};
    \node[my circle,label={[fill=white]above right:$C$}] at (C) {};
    \node[my circle,label={[fill=white]below right:$D$}] at (D) {};
  \end{tikzpicture}
\end{document}

광선과 교차점

답변3

관심 있는 분들을 위한 내용은 다음과 같습니다.메타포스트LuaLaTeX로 처리할 솔루션입니다.

교차점 P는 intersectionpoint두 경로 사이에 MetaPost의 편리한 연산자를 사용하여 다음 지침을 통해 계산됩니다.

P = (C--A) rotatedaround (C,90) intersectionpoint (D--B) rotatedaround (D,-90);

P를 통과하는 CD에 대한 수직은 P를 선분 CD의 중간점에 연결하여 간단히 얻을 수 있습니다.

Q = .5[C,D]; … draw P--Q; 

anglebetweenMetaPost의 일부인 매크로 덕분에 직각 표시도 추가했습니다.메타펀체재.

\documentclass[border=2mm]{standalone}
\usepackage{luamplib}
  \mplibsetformat{metafun}
  \mplibtextextlabel{enable}
\begin{document}
  \begin{mplibcode}
    u := 2cm; pair A, B, C, D, P, Q; 
    A = u*(-.5,-.75); B = u*(-.5,.5); C = u*(1,.5); D = u*(1,-.75); Q = .5[C,D];
    path rectangle; rectangle = A--B--C--D--cycle;
    P = (C--A) rotatedaround (C,90) intersectionpoint (D--B) rotatedaround (D,-90);
    beginfig(1);
      fill rectangle withcolor yellow; 
      pickup pencircle scaled .1bp;
      drawoptions(withcolor red);
      draw B--D; draw A--C;
      draw C -- 1.5[C,P]; draw D -- 1.5[D,P];
      drawoptions(withcolor black);
      freelabeloffset := 5bp;
      forsuffixes M = A, B, C, D, P:
        drawdot M withpen pencircle scaled 3bp;
        freelabel("$" & str M & "$", M, center rectangle);
      endfor
      draw P--Q;
      anglemethod := 2; anglelength := 4bp;
      draw anglebetween(C--A, C--P, "");
      draw anglebetween(D--B, D--P, "");
      draw anglebetween(Q--C, Q--P, "");
    endfig;
  \end{mplibcode}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보