9

The following MWE shows what appears to be a piece of paper folded. I want to indicate that the angle between the dashed lines is right angled by adding a simple square at M, such that the missing edges of the square are parallel to MD and MD2.

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[z={(0,1)},y={(1,0.6)},x={(3,-1)}]
    \coordinate (A) at (0,2);   
    \coordinate (B) at (3,2);   
    \coordinate (C) at (3,0);   
    \coordinate (M) at (0.92,1.38);
    \coordinate (D) at (1.85,2.77);

    \draw[fill=white] (A)node{A}--(B)node{B}--(C)node{C}--cycle;

    \path (M) ++(0,0,2.3) coordinate (D2);
    \draw[fill=white,opacity=0.8](A)--(D2)--(C);

    \draw[dashed](D2)node{D2}--(M)node{M}--(D)node{D};

    \end{tikzpicture}

\end{document}

enter image description here

9
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\RightAngle}[4][5pt]{%
        \draw ($#3!#1!#2$)
        --($ #3!2!($($#3!#1!#2$)!.5!($#3!#1!#4$)$) $)
        --($#3!#1!#4$) ;
        }

\begin{document}

\begin{tikzpicture}[z={(0,1)},y={(1,0.6)},x={(3,-1)}]
    \coordinate (A) at (0,2);
    \coordinate (B) at (3,2);
    \coordinate (C) at (3,0);
    \coordinate (M) at (0.92,1.38);
    \coordinate (D) at (1.85,2.77);

    \draw[fill=white] (A)node[left]{A}--(B)node[right]{B}--(C)node[below]{C}--cycle;

    \path (M) ++(0,0,2.3) coordinate (D2);
    \draw[fill=white,opacity=0.8](A)--(D2)--(C);

    \draw[dashed]
        (D2)node[above]{D2}--
        (M)node[left]{M}node[coordinate,pos=0.85](Mu){}--
        (D)node[right]{D}node[coordinate,pos=0.1](Md){};

    \RightAngle{(D2)}{(M)}{(D)}; 
    \RightAngle{(C)}{(B)}{(A)}; 
    \RightAngle{(M)}{(D2)}{(C)}; 
    \end{tikzpicture}

\end{document}

enter image description here

  • This solution works best as it respects what you said as a comment elsewhere: the right angle is parallel to the edges. Many thanks. – Geoff Mar 4 '14 at 15:16
7

You can define a coordinate and draw the right angle sign:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[z={(0,1)},y={(1,0.6)},x={(3,-1)}]
    \coordinate (A) at (0,2);
    \coordinate (B) at (3,2);
    \coordinate (C) at (3,0);
    \coordinate (M) at (0.92,1.38);
    \coordinate (D) at (1.85,2.77);

    \draw[fill=white] (A)node[left]{A}--(B)node[right]{B}--(C)node[below]{C}--cycle;

    \path (M) ++(0,0,2.3) coordinate (D2);
    \draw[fill=white,opacity=0.8](A)--(D2)--(C);

    \draw[dashed](D2)node[above]{D2}--(M)node[left]{M}node[coordinate,pos=0.85](Mu){}--(D)node[right]{D}
                                                node[coordinate,pos=0.1](Md){};
    \node[coordinate] (Muu) at (Mu-|Md) {};
    \draw ([yshift=-0.5]Mu) -- (Muu) -- (Md);       %%% here and coordinates in above line.
    \end{tikzpicture}

\end{document}

enter image description here

PS I have also changed the positions of other nodes for clarity.

  • IMHO it is not correct because lines of the rightangle mark must be paralelles to the sides of the angle ? – Tarass Mar 3 '14 at 6:27
  • @Tarass You can cheat always ;) – user11232 Mar 3 '14 at 7:49
  • Touché !!!! ;-) – Tarass Mar 3 '14 at 8:39
5

If I understand you right, right angle can be defined using tkz-euclide package:

\documentclass{article}
\usepackage{tikz,tkz-euclide}
\usetkzobj{all}

    \begin{document}

    \begin{tikzpicture}[z={(0,1)},y={(1,0.6)},x={(3,-1)}]
        \coordinate (A) at (0,2);   
        \coordinate (B) at (3,2);   
        \coordinate (C) at (3,0);   
        \coordinate (M) at (0.92,1.38);
        \coordinate (D) at (1.85,2.77);

        \draw[fill=white] (A)node{A}--(B)node{B}--(C)node{C}--cycle;

        \path (M) ++(0,0,2.3) coordinate (D2);
        \draw[fill=white,opacity=0.8](A)--(D2)--(C);

        \draw[dashed](D2)node{D2}--(M)node [left] {M}--(D)node{D};

       \tkzMarkRightAngle(D2,M,D);

         \end{tikzpicture}

    \end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.