\left\{\operatorname{mod}\left(g-d,360\right)<270:\operatorname{mod}\left(g-d,360\right),\operatorname{mod}\left(g-d,360\right)\ge270:\operatorname{mod}\left(g-d,360\right)-360\right\} dir to point: the new direction: n=\left\{\operatorname{mod}\left(g-d,360\right)<270:\operatorname{mod}\left(g-d,360\right),\operatorname{mod}\left(g-d,360\right)\ge270:\operatorname{mod}\left(g-d,360\right)-360\right\} the good number: \left\{-\frac{f}{2}<n<\frac{f}{2}:n\frac{480}{f}\right\} \left\{-\frac{f}{2}<\left\{\operatorname{mod}\left(\arctan\left(\frac{y_{1}}{x_{1}}\right)+\left\{x_{1}<0:180,x_{1}\ge0:0\right\}-d,360\right)<270:\operatorname{mod}\left(\arctan\left(\frac{y_{1}}{x_{1}}\right)+\left\{x_{1}<0:180,x_{1}\ge0:0\right\}-d,360\right),\operatorname{mod}\left(\arctan\left(\frac{y_{1}}{x_{1}}\right)+\left\{x_{1}<0:180,x_{1}\ge0:0\right\}-d,360\right)\ge270:\operatorname{mod}\left(\arctan\left(\frac{y_{1}}{x_{1}}\right)+\left\{x_{1}<0:180,x_{1}\ge0:0\right\}-d,360\right)-360\right\}<\frac{f}{2}:\left\{\operatorname{mod}\left(\arctan\left(\frac{y_{1}}{x_{1}}\right)+\left\{x_{1}<0:180,x_{1}\ge0:0\right\}-d,360\right)<270:\operatorname{mod}\left(\arctan\left(\frac{y_{1}}{x_{1}}\right)+\left\{x_{1}<0:180,x_{1}\ge0:0\right\}-d,360\right),\operatorname{mod}\left(\arctan\left(\frac{y_{1}}{x_{1}}\right)+\left\{x_{1}<0:180,x_{1}\ge0:0\right\}-d,360\right)\ge270:\operatorname{mod}\left(\arctan\left(\frac{y_{1}}{x_{1}}\right)+\left\{x_{1}<0:180,x_{1}\ge0:0\right\}-d,360\right)-360\right\}\frac{480}{f}\right\} desmos calculator how I figure out all the math