it’s not an easy subject to teach in a forum.
suggest that op google for the trigonometry of right angles… (or, better yet, take trig in school, eventually)
it’s no coincidence that sin(pi/4) == sqrt(2)/2
just work Pythagorus “backwards” asking “what would ‘a’ and ‘b’ need to be if ‘c’ is to equal one?”
we know a==b in a 45-45-90, and we want c==1 because we’re in need of a unit vector (even though we maybe don’t yet recognize it by that name)
…so, even better yet, take linear algebra while still in school, and recognize the relationship between unit vectors and trig, then drop the trig altogether - because all you really need to construct this sort of geometry is a single unit vector representing the desired angle.
(in *code* you’d need another vector to work *with*, to preserve your original, but that’s just an implementation detail, conceptually it’s still just the single vector doing all the work)
for example, given the unit vector <cos(45),sin(45)>, you’d proceed like this:
define a starting location
scale your vector to desired wall length
translate your vector to starting location
the end of that vector is now the end of your line (and the start of the next)
rotate your vector perpendicular (+/- 90 degrees; <vx,vy> = <-vy,vx> or <vy,-vx> )
repeat
(and the wall on the other side is just “translate-perpendicular-scaled-by-path-width”)
with such a construction method, it’d be entirely trivial to switch to 50/40 degrees, or 60/30, or 70/20, etc.
…or just draw the whole thing orthogonally and simply rotate the camera. :D