Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

How to determine whether a region of a tiled hexmap is convex?

$
0
0
I have a set of tiles in an hexagonal coordinate system, and I want to see whether it forms an "almost convex" region. By almost convex, I mean that a square with zigzaging hex edges would still count as convex. The idea is to split non convex regions into convex ones, and merge small regions into larger convex ones. What I don't want is merging a corridor with a room or 2 rooms separated by a wall together. I was thinking about sweeping a line along 2 axis and see whether it goes through any missing tile (in case of diagonal, the check would fail only if both tiles are missing). Would that work? Edit: it wouldn't, as a L or cross shaped area would pass. How can I do it?

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>