Hex Grid

john's Avatar

john

Jun 01, 2018 @ 09:23 AM

UPDATE: IMPROVED VERSION ATTACHED TO NEXT COMMENT

Attached is an alternative to the grid node that creates hexagonal grids: hexgrid.

The hexgrid subnetwork takes 3 parameters: columns, rows, and radius. Columns and rows work just like the grid node to define the layout of the hexagonal grid, though here the "rows" snake up and down. Radius defines the radius of the hexagonal cell around each point in the grid. So instead of setting an overall width and height as in the grid node, you set the cell size and the overall grid will grow or shrink accordingly.

If you attach the output of hexgrid to a polygon with Sides set to 6 and a Radius matching the value defined in hexgrid, then colorize that polygon with a non-zero stroke and empty (white or alpha zero) fill, you will have a sheet of hexagonal graph paper. If you make your polygon radius smaller you will create an empty border around each hexagon. Or you could place other shapes in each cell to create many interesting effects.

The attached demo network shows one simple use: a hexagonal color wheel. The hexgrid node is at the top set to 16 columns and 16 rows for a total of 256 cells. I first sort the output using Angle to Point, then feed those positions into a 6-sided polygon node to create the hexagons. I color them with a hue from 0 to 255 and add hue numbers inside each hexagon to create a color chart.

If you wish to create a display with skinnier or fatter hexagons, just take the final output and scale it. I provide a scale node at the bottom of the demo network for you to play with. You can also change the radius of polygon node, change the three parameters in the hexgrid node, etc. Increasing the number of cells will make a more high-res color chart.

Special thanks to Lucas who suggested one approach to generating this grid: skewing a normal grid and then taking a rectangular subset. I haven't seen his hexgrid but thought it would be fun to make my own using this approach. You can inspect hexgrid to see how I did this.

Enjoy!

John

  1. Support Staff 1 Posted by john on Dec 30, 2018 @ 07:20 AM

    john's Avatar

    Attached is an improved version of the hexgrid node.

    It has a cleaner and simpler internal structure and two slight behavior differences:

    - the rows go up-down-up instead of down-up-down
    - the points are ordered left to right top to bottom as they are in a grid node

    Enjoy!

Reply to this discussion

Internal reply

        No formatting (switch to Markdown)

        Already uploaded files

        • Hexgrid_Screenshot.png 911 KB
        • hex_grid.zip 2.19 KB

          You can attach files up to 10MB

          If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

            Keyboard shortcuts

            Generic

            ? Show this help
            ESC Blurs the current field

            Comment Form

            r Focus the comment reply box
            ^ + ↩ Submit the comment

            You can use Command ⌘ instead of Control ^ on Mac