コード例 #1
0
ファイル: Obiect.cs プロジェクト: radupetrusan/BRExpand
        public Obiect(Obiect obiect)
        {
            Id             = obiect.Id;
            LiniiPerimetru = obiect.LiniiPerimetru;
            Puncte         = obiect.Puncte;
            Varfuri        = new List <Point>();
            obiect.Varfuri.ForEach(p => Varfuri.Add(p));

            EConvex = false;
        }
コード例 #2
0
        public List <Point> CalculeazaPuncteInterioare(Obiect obiect, Point min, Point max)
        {
            var list = new List <Point>();

            for (var y = min.Y; y < max.Y; y++)
            {
                for (var x = min.X; x < max.X; x++)
                {
                    Point p = new Point(x, y);
                    //daca punctul e in interior, adauga
                    if (PunctInInteriorulObiectului(p, obiect, max.X))
                    {
                        list.Add(p);
                    }
                }
            }
            return(list);
        }
コード例 #3
0
        private bool PunctInInteriorulObiectului(Point punct, Obiect obiect, int x)
        {
            var linie = new Linie(punct, new Point(x, punct.Y));
            var count = 0;

            foreach (var linieObiect in obiect.LiniiPerimetru)
            {
                if (linie.IntersecteazaSegment(linieObiect))
                {
                    count++;
                }
            }

            if (count % 2 == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }