Esempio n. 1
0
        public GlPointR2[] getIntersection(GlFigure F)
        {
            if (F == null)
            {
                return new GlPointR2[] { }
            }
            ;

            try { return(this.getIntersection(F as GlCurve)); } catch {
                try { return(this.getIntersection(F as GlPolygon)); } catch {
                    try { return(this.getIntersection(F as GlLineR2)); } catch {
                        try { return(this.getIntersection(F as GlFigureSystem)); } catch {
                            try { return(this.getIntersection(F as GlPointR2)); } catch {
                                return(new GlPointR2[] { });
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        ////////////////DRAW_METHODS///////////////////
        ///////////////////////////////////////////////
        /////////////ADDITIONAL_METHODS////////////////

        public void AddFigure(GlFigure F)
        {
            if (F == null)
            {
                return;
            }

            if (OnFigureAddingStart != null)
            {
                if (!OnFigureAddingStart.Invoke(F, this))
                {
                    return;
                }
            }

            if (OnFigureAdding != null)
            {
                OnFigureAdding.Invoke(F, this);
            }

            GlFigure[] copy = this.figuresAmount;
            this.figuresAmount = new GlFigure[this.figuresAmount.Length + 1];
            Array.Copy(copy, this.figuresAmount, copy.Length);
            this.figuresAmount[this.figuresAmount.Length - 1] = F;

            float X = 0, Y = 0;

            foreach (GlFigure FG in figuresAmount)
            {
                countOfPoints += F.CountOfPoints;
                X             += F.Center.X;
                Y             += F.Center.Y;
            }

            this.systemCenter = new GlPointR2(X / figuresAmount.Length, Y / figuresAmount.Length);

            if (OnFigureAdded != null)
            {
                OnFigureAdded.Invoke(F, this);
            }
        }