# Math in Unity : create a “graphic grid” with Cartesian Plane and Line Renderer (Part II)

As for the second problem, we should calculate some sort of “offset” and draw the lines based on that offset multiplied by the size of the grid.

For example: if we have our dimension of 13, our offset will be, in this case, 160 divided by 13.
Remember: our size is an int, but if it were a float, we need to store the result in a variable with EXPLICIT CAST.
Like this :

In this specific case, the result is 12.307…
But because we cast as int, the result is 12.
If we muliply 12 for the size (13), the result is
12 * 13 = 156

What does it mean?

The offset is simply the DIVIDER of the number 160 (in this case).
When we have the divider, we can multiply it by the size of the grid and find exactly where to draw our lines, and being 8 a divider of 160, like 20, at some point a line will coincide perfectly with our Cartesian plane.

# Ang again in the third iteration-144 + 12 = -132

At the end, this is the result :

and stop.

Let’s try in code and see

Obviously this process must also be repeated for the Y, unless the number is identical

We now apply this offset in our for loop