# Marking right angles (structuralanalysis)

I'm trying to draw this picture:

Until now, I have this, with the help of structuralanalysis package:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usepackage{structuralanalysis}

\begin{document}
\begin{tikzpicture}[>=triangle 45]
\draw[thick, ->] (-{sqrt(8)},-{sqrt(8)}) arc (225:-45:4cm)node[below right] {$L$};
\draw[thick,->] (0,0) -- (2.79,2.79);
\draw[color=black] (1.75,1.2) node[left] {$R$};
\draw[thick,->] (3,3) -- (4,4.5);
\draw[color=black] (3.9,4.4) node[above] {$\varphi$};
\draw[color=black] (4.7,2) node[above] {$w$};
\draw[thick,->] (3,3) -- (4.5,2);
\draw[thick, ->] (4,3.5) arc (-90:180:1cm)node[below] {$\psi$};
\point{a}{-{sqrt(8)}}{-{sqrt(8)}};
\support{3}{a}[45];
\end{tikzpicture}
\end{document}


My question is how I can draw a right angle markings of the original drawing? I would draw each square using four points calculated manually (A, B, C, D, by example) and then

  \draw A--B--C--D--A;


but I think there must be a shorter way.

Similar to Insertion of perpendicular symbol at intersection of two perpendicular lines but with pic. The syntax is similar to the one of the angle library (which can be used to annotate angles of any degree with various styles.

I also adjusted your code and used

• polar coordinates (<angle>:<radius>),
• named coordinates, and
• automatically placed nodes and coordinates along a path.

## Code

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta,angles,calc}
\usepackage{structuralanalysis}
\tikzset{
angleR distance/.initial=.3cm,
pics/angleR/.style args={#1--#2--#3}{% This asumes a right angle between #2, #1 and #3
setup code={%
% This is the same as
% … let \p0=($(#2.center)-(#1.center)$),
% \n0=(atan2(\y0,\x0) in …
% and storing \n0 in \tikzAngleRotate (or using it directly)
\pgfmathanglebetweenpoints
{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}%
\let\tikzAngleRotate\pgfmathresult},
foreground code={
\path[pic actions, rotate=\tikzAngleRotate]
($(#2)!\pgfkeysvalueof{/tikz/angleR distance}!(#1)$)
|- ($(#2)!\pgfkeysvalueof{/tikz/angleR distance}!(#3)$);}
}
}
\begin{document}
\begin{tikzpicture}[>=Triangle, auto=right, thick]
\draw[->] (225:4) arc [start angle=225, end angle=-45, radius=4]
coordinate[at start] (arc-start)
node[at start, left] {$O$}
node[below right] {$L$} coordinate[pos=2/3] (arc-tr);
\draw[->, shorten >=\pgflinewidth] (0,0) -- node {$R$} (arc-tr);

\coordinate (arc-tr') at ([shift=(45:.2cm)]arc-tr);
\coordinate (O) at (0,0)
coordinate (arc-start-e) at ([shift=(90+45:3)]arc-start);
\draw[<->, shift=(arc-tr'), inner sep=.1667em] (45-90:1.5cm) coordinate (arc-tr'-A)
-- node[at start] {$w$}       (0,0)                       coordinate (arc-tr'-B)
-- node[at end]   {$\varphi$} (45:1.5cm)                  coordinate (arc-tr'-C);
\draw[shift=(arc-tr'-C), ->] (-90:1cm)
arc[start angle=-90, end angle=180, radius=1cm] node[left] {$\psi$};

\support{3}{arc-start}[45];
\pic[draw, thin] {angleR=arc-tr'-A--arc-tr'-B--arc-tr'-C};
\pic[draw, thin, angleR distance=.15cm] {angleR=O--arc-start--arc-start-e};
\end{tikzpicture}
\end{document}


## Output

I will explain for one of the right angle marks. First draw two coordinates

\coordinate (O) at (0,0);
\coordinate (A) at (-{sqrt(8)},-{sqrt(8)});


Then draw a path with 5mm length that is at right angle to the path OA like

\path (A) -- ($(A)!5mm!90:(O)$)coordinate (A1);


Let the end of this path be called A1. Now draw a path similarly but at an angle 45 to OA like

\path (A) -- ($(A)!2mm!45:(O)$)coordinate (A2);


and with angle 0 like

\path (A) -- ($(A)!5mm!(O)$)coordinate (A3);


Then draw the projection of A2 on to path AA1

\draw (A2) -- ($(A)!(A2)!(A1)$);


and the projection of A2 on path AA3

\draw (A2) -- ($(A)!(A2)!(O)$);


For the other one follow the same steps.

Code:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usepackage{structuralanalysis}

\begin{document}
\begin{tikzpicture}[>=triangle 45]
\draw[thick, ->] (-{sqrt(8)},-{sqrt(8)}) arc (225:-45:4cm)node[below right] {$L$};
\draw[thick,->] (0,0) -- (2.79,2.79);
\draw[color=black] (1.75,1.2) node[left] {$R$};
\draw[thick,->] (3,3) -- +(45:2cm) coordinate (AA);
\draw[color=black] (3.9,4.4) node[above] {$\varphi$};
\draw[color=black] (4.7,2) node[above] {$w$};
\draw[thick,->] (3,3) -- +(-45:2cm) coordinate (BB);
\draw[thick, ->] (3,3)+(1,0.1) arc (-90:180:1cm)node[below] {$\psi$};
\point{a}{-{sqrt(8)}}{-{sqrt(8)}};
\support{3}{a}[45];

\coordinate (O) at (0,0);
\coordinate (A) at (-{sqrt(8)},-{sqrt(8)});
\path (A) -- ($(A)!5mm!90:(O)$)coordinate (A1);
\path (A) -- ($(A)!2mm!45:(O)$)coordinate (A2);
\path (A) -- ($(A)!5mm!(O)$)coordinate (A3);
\draw (A2) -- ($(A)!(A2)!(A1)$);
\draw (A2) -- ($(A)!(A2)!(O)$);

\coordinate (OO) at (3,3);
\path (3,3) -- +(0:4mm) coordinate (AB);
\draw (AB) -- ($(AA)!(AB)!(OO)$);
\draw (AB) -- ($(BB)!(AB)!(OO)$);

\end{tikzpicture}
\end{document}


With tkz-euclid

\documentclass{standalone}
\usepackage{tkz-euclide}                 %% Add this
\usetkzobj{all}                          %% Add this
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usepackage{structuralanalysis}

\begin{document}
\begin{tikzpicture}[>=triangle 45]
\draw[thick, ->] (-{sqrt(8)},-{sqrt(8)}) arc (225:-45:4cm)node[below right] {$L$};
\draw[thick,->] (0,0) -- (2.79,2.79);
\draw[color=black] (1.75,1.2) node[left] {$R$};
\draw[thick,->] (3,3) -- +(45:2cm) coordinate (AA);
\draw[color=black] (3.9,4.4) node[above] {$\varphi$};
\draw[color=black] (4.7,2) node[above] {$w$};
\draw[thick,->] (3,3) -- +(-45:2cm) coordinate (BB);
\draw[thick, ->] (3,3)+(1,0.1) arc (-90:180:1cm)node[below] {$\psi$};
\point{a}{-{sqrt(8)}}{-{sqrt(8)}};
\support{3}{a}[45];

\coordinate (O) at (0,0);
\coordinate (A) at (-{sqrt(8)},-{sqrt(8)});
\path (A) -- ($(A)!5mm!90:(O)$)coordinate (A1);
%\path (A) -- ($(A)!2mm!45:(O)$)coordinate (A2);
\path (A) -- ($(A)!5mm!(O)$)coordinate (A3);
\tkzMarkRightAngle(A1,A,A3)   %% Add this

\coordinate (OO) at (3,3);
\tkzMarkRightAngle(AA,OO,BB)     %% Add this

\end{tikzpicture}
\end{document}

• If you want shorter way, use tkz-euclide. It provides \tkzMarkRightAngle(A,B,C) where A, B, C are cordinates similar to A1, A, A3. That means, declare coordinates A1, A and A3 as in the answer and then use \tkzMarkRightAngle(A1,A,A3) – user11232 May 15 '15 at 8:18
• Your answer works fine. But using tkz-euclid, I get an error, in my edited question I describe it. – G. Aguilera May 15 '15 at 19:17
• @G.Aguilera I have added a tkz-euclide version. – user11232 May 16 '15 at 2:12

Harish showed the correct way, but you can also use some tricky ones.

These right angle marks can be drawn as little squares conveniently rotated and shifted. You just need to know where is the angle origin and rotation.

Next code draws one mark with an squared empty node and the other one with a rectangle.

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usepackage{structuralanalysis}

\begin{document}
\begin{tikzpicture}[>=triangle 45]
\draw[thick, ->] (-{sqrt(8)},-{sqrt(8)}) arc (225:-45:4cm)node[below right] {$L$};
\draw[thick,->] (0,0) -- (2.79,2.79);
\draw[color=black] (1.75,1.2) node[left] {$R$};
\draw[thick,->] (3,3) -- (4,4.5);
\draw[color=black] (3.9,4.4) node[above] {$\varphi$};
\draw[color=black] (4.7,2) node[above] {$w$};
\draw[thick,->] (3,3) -- (4.5,2);
\draw[thick, ->] (4,3.5) arc (-90:180:1cm)node[below] {$\psi$};
\point{a}{-{sqrt(8)}}{-{sqrt(8)}};
\support{3}{a}[45];

\node[minimum size=3mm, inner sep=0pt, draw=green,
anchor=south west, rotate=-atan(1/1.5)] at (3,3) {};

\begin{scope}[shift={(a)}, rotate=45]
\draw[red] (0,0) rectangle ++(2mm,2mm);
\end{scope}

\end{tikzpicture}
\end{document}
`