Help understanding grid code

I am studying the grid code to get a better understanding of it and I got stuck at a specific. Before anything let me say, before coming here to ask I really tried to understanding by myself, spent most of a dat searching about, I don’t know if I am searching the right terms, and trying to draw the situation, but couldn’t wrap my head around.

// get left extent
            double xb1 = x;
            double yb1 = y;
            // to the left
            newpos(ref xb1, ref yb1, angle - 90, diagdist / 2 + distance);
        static void newpos(ref double x, ref double y, double bearing, double distance)
            double degN = 90 - bearing;
            if (degN < 0)
                degN += 360;
            x = x + distance * Math.Cos(degN * deg2rad);
            y = y + distance * Math.Sin(degN * deg2rad);

I can understand that before this, the code used the max and min values of x and y to build a rectangular area and get the center and then use said center in the formula above to do some sort of rotation, but I couldn’t follow based on the variables used

angle is the target direction
angle - 90 is the angle perpendicular

new pos is using a bearing and distance to project the new coord

the likely term you are after is
Polar to Cartesian

Hi, thank you for answering. I think I get it, so if the target direction is 30º, the angle-90 is -60º. Then, with 90- bearing, 90 -(-60) = 150. With 150 and using diagdist/2 + distance between the lines, I get a new coordinate, using the rectangle center as reference. Is that it?

sounds correct, i didn’t 100% verify though