# [Tex/LaTex] How to make right angle mark in geometry 3D like this picture

pstrickstikz-3dplottikz-pgf

I want to mark right angle. I tried in Geogebra

\documentclass{standalone}
\usepackage{pstricks-add}
\begin{document}
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=*,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\begin{pspicture*}(-2.37,-0.3)(6.25,4.31)
\psline(1.56,0.36)(4.66,1.76)
\psline(0.68,1.36)(2.68,0.87)
\psline(0.68,3.92)(2.68,0.87)
\psline(2.49,1.15)(2.82,1.3)
\psline(2.82,1.3)(3.01,1.01)
\psline(1.82,0.8)(2.28,0.69)
\psline(1.82,0.8)(2.22,0.98)
\psline(0.68,3.92)(0.68,1.36)
\psline(0,2)(-2,0)
\psline(0,2)(6,2)
\psline(6,2)(4,0)
\psline(4,0)(-2,0)
\parametricplot{0.0}{0.7853981633974483}{1*0.91*cos(t)+0*0.91*sin(t)+-2|0*0.91*cos(t)+1*0.91*sin(t)+0}
\psline(-2,0)(4,0)
\psline(1,1.58)(0.68,1.66)
\psline(1,1.58)(1,1.28)
\rput[tl](2.69,0.79){H}
\rput[tl](0.51,1.27){K}
\psdots(1.56,0.36)
\rput[bl](1.7,0.15){$A$}
\psdots(4.66,1.76)
\rput[bl](4.7,1.5){$B$}
\psdots(0.68,3.92)
\rput[bl](0.74,3.99){$M$}
\rput[bl](-1.53,0.12){$\beta$}
\end{pspicture*}
\end{document}


How can I draw with anorher way?

#### Best Answer

This is one possible solution via tikz-3dplot. Here numbers are used for labeling for ease of programming. Explanatory comments are added in the code. The right angles on the xy plane are found via intersections of grid lines notion, that is, finding intersection points of parellel lines that are parallel to d5-d6 and d7-d8.

Code

\documentclass[border=2pt]{standalone}
%\usepackage[utf8]{inputenc}
\usepackage{tikz,tikz-3dplot}
\usetikzlibrary{calc,positioning,intersections}
\tdplotsetmaincoords{70}{120}
\begin{document}
\begin{tikzpicture}[scale=2, tdplot_main_coords,axis/.style={->,dashed},thick]
% -- remove these 3 lines if no axis is preferred
\draw[axis] (-2, 0, 0) -- (5, 0, 0) node [right] {$X$};
\draw[axis] (0, 0, 0) -- (0, 5, 0) node [above] {$Y$};
\draw[axis] (0, 0, 0) -- (0, 0, 2) node [above] {$Z$};
% define points
\coordinate  (d1) at (0,0,0){};
\coordinate  (d2) at (4,0,0){};
\coordinate  (d3) at (4,4,0){};
\coordinate  (d4) at (0,4,0){};
\coordinate  (d5) at (3,2,0){};
\coordinate  (d6) at (1,3,0){};
\coordinate  (d7) at ($(d5)!0.7!(d6)$){};
\coordinate  (d8) at (1,1,0){};
\coordinate  (d9) at (1,1,2){};
\path  (d7) -- ($(d7)!-2cm!(d8)$) coordinate(e1);    % find the extended point e1
\path  (d5) -- ($(d5)! 3cm!(d6)$) coordinate(e2);    % find the extended point e2
% connect lines
\draw [] (d1)--(d2)--(d3)--(d4) -- (d1);
\draw [name path=line4] (d5) --(d6);
\draw [] (d7) --(d8) -- (d9)-- (d7);
\coordinate (a) at ($(d8)!0.2!(d7)$);                % find point a on the  line d8-d7
% draw vertical lines of length 0.3cm and form a right angle on z plane
\draw [red] (d8)  ++(0,0,0.3) -- ($(a)+(0,0,0.3)$)--(a);
% auxiliary lines to find right corners via drawing parallel/grid lines
\path [name path=line1] ([xshift= 0.5cm]d8) -- ([xshift= 0.5cm]d7);
\path [name path=line2] ([xshift=-0.5cm]d8) -- ([xshift=-0.5cm]e1);
\path [name path=line3] ([xshift=-1cm]d5) -- ([xshift=-1cm]e2);
% find intersections corners
\path [name intersections={of=line1 and line3, by={D1}}];
\path [name intersections={of=line1 and line4, by={D2}}];
%
\path [name intersections={of=line2 and line3,by={E1}}];
\path [draw,name intersections={of=line2 and line4, by={E2}}];
\draw [red]  (D1) -- (D2)   (E1) -- (E2)  (E1) -- (D1);
% --- labels for vertices
\foreach \i in {1,2,...,9}
{
\draw[fill=black] (d\i) circle (0.1em) node[above left] {\i};
}
\draw (d2) -- ++(0,0.5,0) arc (90:150:1)node[below]{\Large $\beta$};

\end{tikzpicture}
\end{document}