Esempio n. 1
0
        public static Shape[] Series(Fr[] members, double?volume = 0.05, bool triangulateOnly = false, int count = 256,
                                     double pointPrecision = 0.01, int[] indices = null)
        {
            var polygon  = Polygons.FourierSeries(count, members.Perfecto());
            var polygons = Splitter.FindPerimeter(polygon, pointPrecision);

            if (indices != null)
            {
                polygons = indices.Select(i => polygons[i]).ToArray();
            }

            var shapes = polygons.Select(p => (triangulateOnly ? p.ToShape(null, true) : p.ToShape(volume)).Rotate(Math.PI / 2)).ToArray();

            var size = polygons.Select(p => p.ToShape().Rotate(Math.PI / 2)).ToSingleShape().Size;

            var maxXY = Math.Max(size.x, size.y);

            shapes.Index().ForEach(i =>
            {
                shapes[i] = shapes[i].Scale(1 / maxXY, 1 / maxXY, 1);
            });

            return(shapes);
        }