Skip to content

Create HexGrid Class #724

Open
Open
@f-bdolan

Description

@f-bdolan

Ursina offers an out-of-the-box Grid class here

Arguments could include

  • side length (or calculated from apothem)
  • grid_width
  • grid_height
  • apothem (or calculated from side_length)

Another useful class would be a HexGrid version. This would be a hexmat style instead of rectangles. Some minor radius calculations would be necessary. Key facts can be find here for instance.

Quick definitions for a regular hexagon (one with all equal sides)

  • The side length a is the length of one of the six edges.
  • The circumradius R is the distance from the center to an edge vertex. This is equivalent to what you would call the radius in a circle.
  • The apothem r is the distance from the center to the midpoint of a side. It maybe useful to note that given a radius R, the apothem r = R * sqrt(3)/2
  • Given a radius R, the side length a= R

Might be a good first issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions