I need to rotate a quad on the screen, however i can't get good perpendicular vector, as well as the size of an arrow.
Issue with this is that screen height is 2x the screen width and i am not entirely sure how to transform that to new quad vertices that are in screen space (0..1)
Basically i am trying to draw it in screen space coords from 0..1 to maintain arrow size.
Now what you see below is an attempt to draw arrows that are perpendicular to the first white line in index
Since it's 2D i want to stick to line direction and perpendicular vector to that direction
so vertices would look like, none of this work (don't mind arrow dimensions i believe that properly calculated directions will deal with that) basically i am trying to find perpendicular vector, i may calculate wrongly the direction too.
float aspect = screen_height / screen_width;
vec3 line_dir = (line_v[1] - line_v[0]);
line_dir.y = line_dir.y * aspect;
line_dir = normalize( line_dir );
top left relative to line direction.
v[0] = line_center + line_dir * (arrow_height / 2.0);
top right
v[1] = line_center + line_dir * (arrow_height / 2.0) + perpendicular_dir * arrow_width;
bottom right
v[2] = line_center - line_dir * (arrow_height / 2.0) + perpendicular_dir * arrow_width;
bottom left
v[3] = line_center - line_dir * (arrow_height / 2.0);
![](https://uploads.gamedev.net/forums/monthly_2021_03/627a75f4776c4f73bc198136eea7372c.SVID_20210311_055741_1.gif)