using System;
using System.Collections.Generic;
using Windows.Foundation;

namespace PCUT.DeepNestApi
{
    public class LocalContour
    {
        public double Len
        {
            get
            {
                double len = 0;
                for (int i = 1; i <= Points.Count; i++)
                {
                    var p1 = Points[i - 1];
                    var p2 = Points[i % Points.Count];
                    len += Math.Sqrt(Math.Pow(p1.X - p2.X, 2) + Math.Pow(p1.Y - p2.Y, 2));
                }
                return len;
            }
        }
        public List<Point> Points = new List<Point>();
        public bool Enable = true;
        public List<LocalContour> Childrens = new List<LocalContour>();
        public LocalContour Parent;
        public object Tag;

        public void Scale(double v)
        {
            for (int i = 0; i < Points.Count; i++)
            {
                Points[i] = new Point((Points[i].X * v), (Points[i].Y * v));
            }
        }
    }
}
