I think, a pic could help you here. Let TikZ do the trigonometry for you.
When a pic is placed along a path segment with the sloped option, the drawing of the pic will be rotated and shifted so that its x axis is tangential to the path at that point. Its origin also lies on that path.
Unfortunately, some of these settings also apply for the paths inside the pic which is why we need to reset them again (that's why you see sloped = false inside them).
For the angle markings, I'm also going to use a pic but that is not placed along the path, it uses the three coordinates given and calculates the needs angles.
I'm not very happy about its implementation which is why added the shortening amount to its definition so that the lines won't cross our triangles. (Other better but longer solutions exist for this as well.)
I'm also naming the coordinates so I can actually reference them later without having to worry about transformations.
Let's create this diagram step by step.
First, we start with just the triangle and naming its corners:
\draw (0, 0) coordinate (O)
-- (0, 3) coordinate (A)
-- (5, 0) coordinate (B)
-- cycle;
Notice that this one path and a closed on (that's the cycle's doing). The corners will look differently than with your code.
We can place a pic along the A–B edge by placing it either directly after the -- (i.e. “implicitly”) or
after the target coordinate “explicitly“ with a position specified.
Since I'm using sloped here, the pic is placed so that it is rotated so that its x axis follows the slope of the line.
Now, I'm just drawing the box and the vector lines:
\draw[midway, thin] (left:.75) rectangle coordinate () +(1.5,.9);
\path[->, at end, sloped=false]
() edge["\vec F_a" above left] +(left:1)
() edge["\vec N" right] +( up:1)
[reset cm] () edge["\vec P" right] coordinate (P') +(down:1);
Since I've named the pic box all coordinates and nodes named inside the pic will get box prefixed. Thus, the coordinate in the center of the rectangle I draw with the first path which is just named nothing will actually be named box.
Now, since the pic is rotated the direction up and left art orthogonally and parallel to the line we place the box on.
For the truely vertical arrow P I use reset cm to reset the transformation matrix. This will not necessary enact the coordinate system that was in effect before we entered the pic but in this case it is the same.
The second pic is placed very similar but draws just a coordinate system. Since y = 0 is on the line I'll draw it between y = 1 and y = 2 to have it float above the line.
Now, it's just the three angle pics.
And the additional orange dashed lines. This are placed behind path because I think they look better if they are behind the triangle lines.
To draw the vertical dashed line I added a coordinate P' (which will be named boxP') at the tip of the vertical vector.
The coordinate specification (boxP'|-O) specifies the intersection between a vertical line through boxP' and a horizontal line through O.
If you need to draw more than one such diagrams, it is recommended to define your own named pic. In this case, we could do something like
\tikzset{
pic node/left/.style=above left,
pic node/up/.style=right,
pic node/right/.style=below right,
pic node/vertical/.style=right,
pics/box with vectors/.style args={#1:#2:#3}{code={
\draw[midway, thin] (left:.75) rectangle coordinate () +(1.5,.9);
\path[->, at end, sloped=false, pic actions]
() edge["{\vec #1}" pic node/left] +(left:1)
() edge["{\vec #2}" pic node/up ] +( up:1)
[reset cm] () edge["{\vec #3}" pic node/vertical]
coordinate (P') +(down:1);}},
pics/coordinate system/.default={x:y},
pics/coordinate system/.style args={#1:#2}{code={
\draw[<->, sloped=false, pic actions]
(up:1) |- node[at start, pic node/up]{$#2$}
node[at end, pic node/right]{$#1$} (right:1);}}}
and on the path, you just do
pic[pos=.4, sloped] (box) {box with vectors=F_a:N:P}
pic[near end, sloped, thin, Green, shift=(up:1)] {coordinate system}
while having the various pic node/… styles available to adjust the nodes' positions or appearance.
Code
\documentclass[tikz]{standalone}
\usetikzlibrary{angles, arrows.meta, quotes}
\tikzset{math nodes/.style={execute at begin node=$, execute at end node=$}}
\colorlet{Green}{green!75!black}
\begin{document}
\tikz[
pics/angle/.append style={/tikz/shorten >=+.4pt, /tikz/shorten <=+.4pt},
>={Stealth[round]}, % I like this arrow tip better
thick, angle radius=.75cm, angle eccentricity=1.2,
every edge quotes/.append style={math nodes},
every pic quotes/.append style={math nodes, node font=\footnotesize}]
\draw (0, 0) coordinate (O)
-- (0, 3) coordinate (A)
-- (5, 0) coordinate (B)
pic[pos=.4, sloped] (box) {code={
\draw[midway, thin] (left:.75) rectangle coordinate () +(1.5,.9);
\path[->, at end, sloped=false]
() edge["\vec F_a" above left] +(left:1)
() edge["\vec N" right] +( up:1)
[reset cm] () edge["\vec P" right] coordinate (P') +(down:1);
}}
pic[near end, sloped, thin, Green] {code={% yeah, the same trick again
\draw[<->, sloped=false] (0,2) to[at start, "y" right] ++( down:1)
to[at end, "x" below right] ++(right:1);
}}
-- cycle
%
pic[draw, Green, thin, "\theta"] {angle=A--B--O}
pic[draw, blue, thin, "\theta"] {angle=O--box--boxP'}
pic[draw, blue, thin, "\frac{\pi}{2}-\theta" right] {angle=B--O--box}
% I think the dashed lines look better if they're behind the other stuff
[behind path]
(box) edge[orange, densely dashed] (O)
(boxP') edge[orange, dashed] (boxP'|-O)
;
\end{document}
Output

(2.25,2.55) -- ({2.25 + sin(30.96)}, {2.55 - cos(30.96})with(2.25,2.55) -- + (180-30.96:1), I believe. – Qrrbrbirlbel Aug 17 '23 at 23:06