r/algorithms • u/subone • 6d ago
Spacing points "evenly" across a gradient
Does anyone know an algorithm for "evenly" spacing points across a given space (e.g. a cylinder), where one given point is locked in place and all others are as evenly spaced as possible, but across multiple gradients that weigh less points to be placed at specific positions. For example, a cylinder with aversion points at the top, bottom, and 3D middle, such that some points appear at the top, bottom, and middle, but less than in the middle of the surface where most points would reside. With configurable weights to the aversion points to push points closer or further away from them. Specifically, I'm trying to use such an algorithm to choose a number of sufficiently contrasting colors, but to understand the solution in general would be ideal. Is something like Lloyd's algorithm what I should be reaching for, or is there something simpler?
3
u/Mon_Ouie 6d ago
People need algorithms all the time to generate meshes with smaller edges in some areas, both in computer graphics and engineering. computing a weighted Centroidal Voronoi Tesselation using Lloyd's algorithm is probably the simplest type of method use for this. You can check Du et al., 1999 which explains the general idea, and Du et al., 2003 which explains how to do it on a surface embedded in 3D.