Пример #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);
        }
Пример #2
0
 public static Shape SingleSeries(Fr[] members, int count = 256)
 {
     return(Polygons.FourierSeries(count, members.Perfecto()).ToShape().Rotate(Math.PI / 2).Adjust());
 }
Пример #3
0
 public static Shape Polygon(int n, double a = 0.1, int count = 100, bool fill = true) =>
 Polygons.FourierSeries(count, (n - 1, 6 * a / (n - 1)), (-1, 1))
 .Condition(fill, p => p.Fill()).TurnOut().ToShape3()
Пример #4
0
 public static Shape Series3(int an, int bn, double a, double b, int count, bool fill, double da = 0, double db = 0) => Polygons
 .FourierSeries(count, (an, a, da), (bn, b, db), (-1, 1))
 .Condition(fill, p => p.Fill())
Пример #5
0
 public static Shape Star(double a = 0.15, int count = 100, bool fill = true) =>
 Polygons.FourierSeries(count, (4, a), (-1, 1))
 .Condition(fill, p => p.Fill()).TurnOut().ToShape3()