Exemplo n.º 1
0
        public VoronoiMap(IEnumerable <TPoint> points, IGridToWorldMap <TPoint> map)
            : base(Vector2.zero)
        {
            this.map = map;

            /* TODO: make these parameters
             * const float alpha = .5f;
             * const float beta = 20f;
             * func = x => beta * x * Mathf.Pow(x.magnitude, alpha - 1);
             * inverseFunc = x => x / beta * Mathf.Pow(x.magnitude / beta, 1 / alpha - 1);
             */

            func        = x => x;
            inverseFunc = x => x;

            tree = new KDTree <TPoint>(2);

            foreach (var point in points)
            {
                tree.AddPoint((map[point]), point);
            }
        }
Exemplo n.º 2
0
 public SplicedMap(IGridToWorldMap <TBasePoint> baseMap, IEnumerable <Vector2> offsets)
 {
     this.baseMap = baseMap;
     this.offsets = offsets.ToArray();
 }