Weighted cells

from Red Blob Games
10 Oct 2019

I wanted to try drawing mesh cells with a varying size. I’m reusing the rounded cell approach from 1825-rounded-cell-painter, but instead of triangle centers being the centroid of each triangle, I’m using a weighted centroid where the weights affect how close the center is to each of the vertices. The animation on this page sets the weights based on a sine wave but I was thinking the weights might be useful for town sizes or other properties.

The triangle mesh doesn’t change. I move the center point within each triangle to change the sizes of the cells. Click Show structure to see this.

This experiment made me think I should explore isolines for triangle meshes. I think it could be simpler and also produce more interesting shapes. I was hoping it’d be easy but when I tried it[1] it seemed like it would take a lot of experimentation, so that’ll be a separate page.

Source code for this page: weighted-cells.js. There are occasionally rendering glitches but for this quick experiment I didn’t investigate.

Email me , or tweet @redblobgames, or comment: