Exemplo n.º 1
0
 public static IWavyBorder<IEnumerable<Point>> GetWavySurface(
     IWavyBorder<Point> start,
     IWavyBorder<Point> finish,
     IConnectStrategy connectStrategy)
 {
     return start.Zip(finish, connectStrategy.Connect);
 }
Exemplo n.º 2
0
 public static IWavyBorder<IEnumerable<Point>> Connect(
     this IWavyBorder<IEnumerable<Point>> start,
     IWavyBorder<Point> finish,
     IConnectStrategy connectStrategy)
 {
     return start.Glue(WavySurfaceBuilder.GetWavySurface(start.Finish(), finish, connectStrategy));
 }
Exemplo n.º 3
0
 public static IWavyBorder<IEnumerable<Point>> GetWavySurface(
     IWavyBorder<Point> start,
     IWavyBorder<Point> finish,
     IWavyBorder<IConnectStrategy> connectStrategy)
 {
     return start.Zip(finish, connectStrategy, (s, f, cs) => cs.Connect(s, f));
 }
Exemplo n.º 4
0
        public static IWavyBorder<IEnumerable<Point>> Connect(
            this IWavyBorder<Point> start,
            IWavyBorder<Point> finish,
            IWavyBorder<IConnectStrategy> connectStrategy)
        {

            return WavySurfaceBuilder.GetWavySurface(start, finish, connectStrategy);
        }
        public WavySurfaceVisualViewModel(VisualOptions visualOptions, IWavyBorder<IEnumerable<Point>> element)
        {
            var pixelPerUnit = visualOptions.PixelPerUnit;
            var vavySurfaceTransform = element.Transform(pixelPerUnit.Transform);

            Func<IBottom<IEnumerable<Point>>, IEnumerable<Point>> transform = b => b.Start.Concat(b.Finish.Reverse()); 

            Peak = vavySurfaceTransform.Waves.Select(w => w.Peak);
            InSide = vavySurfaceTransform.Waves.Select(w => transform(w.InSide));
            OutSide = vavySurfaceTransform.Waves.Select(w => transform(w.OutSide));
            Bottom = vavySurfaceTransform.Bottoms.Select(transform);

        }
Exemplo n.º 6
0
 /// <summary>
 /// Horizontal concat
 /// </summary>
 /// <param name="first"></param>
 /// <param name="second"></param>
 /// <returns></returns>
 public static IWavyBorder<IEnumerable<Point>> Merge(
     this IWavyBorder<IEnumerable<Point>> first,
     IWavyBorder<IEnumerable<Point>> second)
 {
     var left = first.Bottoms.Last();
     var right = second.Bottoms.First();
     var middle = new Bottom<IEnumerable<Point>>(left.Start, right.Finish); 
     var bottoms = (first.Bottoms.Init())
         .Concat(new[]{middle})
         .Concat(second.Bottoms.Tail());
     var waves = first.Waves.Concat(second.Waves);
     return new WavyBorder<IEnumerable<Point>>(waves,bottoms);
 }
Exemplo n.º 7
0
 public static IWavyBorder<IEnumerable<Point>> Cut(
     this IWavyBorder<IEnumerable<Point>> wavySurface,
     IWavyBorder<double> length)
 {
     return wavySurface.Zip(length, (points, l) => points.Cut(l));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Vertical concat
 /// </summary>
 /// <param name="first"></param>
 /// <param name="second"></param>
 /// <returns></returns>
 public static IWavyBorder<IEnumerable<Point>> Glue(
     this IWavyBorder<IEnumerable<Point>> first,
     IWavyBorder<IEnumerable<Point>> second)
 {
     return first.Zip(second, (f, s) => f.Init().Concat(s));
 }
Exemplo n.º 9
0
 public WavySurfaceBuilder(IWavyBorder<Point> start,
     IWavyBorder<Point> finish,
     IWavyBorder<IConnectStrategy> connectStrategy)
 {
     WavySurface = GetWavySurface(start, finish, connectStrategy);
 }