func WrapMinDist(ci, max, ctr float32) float32 {
	nwd := mat32.Abs(ci - ctr)  
	if mat32.Abs((ci+max)-ctr) < nwd {
		return ci + max
	}
	if mat32.Abs((ci-max)-ctr) < nwd {
		return ci - max
	}
	return ci
}
WrapMinDist returns the wrapped coordinate value that is closest to ctr
i.e., if going out beyond max is closer, then returns that coordinate
else if going below 0 is closer than not, then returns that coord
package prjn
import "github.com/goki/mat32"
func Edge(ci, max int, wrap bool) (int, bool) {
	if ci < 0 {
		if wrap {
			return (max + ci) % max, false
		}
		return 0, true
	}
	if ci >= max {
		if wrap {
			return (ci - max) % max, false
		}
		return max - 1, true
	}
	return ci, false
}