Created octagon pattern with nodes. Is there a easy way to do it

I am trying to learn math nodes. I made octagon pattern but i am not able to figured out how to create hex pattern.

Octagon pattern:

1 Like

I think that a quick and dirty way to do it would be something like this:

Of course it can be optimized.

1 Like

Nice… thanks