コード例 #1
0
ファイル: Polygon.cs プロジェクト: Omybot/GoBot
        /// <summary>
        /// Retourne la liste des points de croisement avec la forme donnée
        /// </summary>
        /// <param name="forme">Forme à tester</param>
        /// <returns>Liste des points de croisement</returns>
        public List <RealPoint> GetCrossingPoints(IShape shape)
        {
            List <RealPoint> output = new List <RealPoint>();

            if (shape is RealPoint)
            {
                output = PolygonWithRealPoint.GetCrossingPoints(this, shape as RealPoint);
            }
            else if (shape is Segment)
            {
                output = PolygonWithSegment.GetCrossingPoints(this, shape as Segment);
            }
            else if (shape is Polygon)
            {
                output = PolygonWithPolygon.GetCrossingPoints(this, shape as Polygon);
            }
            else if (shape is Circle)
            {
                output = PolygonWithCircle.GetCrossingPoints(this, shape as Circle);
            }
            else if (shape is Line)
            {
                output = PolygonWithLine.GetCrossingPoints(this, shape as Line);
            }

            return(output);
        }
コード例 #2
0
ファイル: Polygon.cs プロジェクト: Omybot/GoBot
        /// <summary>
        /// Teste si le polygone courant croise la forme donnée
        /// </summary>
        /// <param name="shape">Forme testée</param>
        /// <returns>Vrai si le polygone croise la forme donnée</returns>
        public bool Cross(IShape shape)
        {
            bool output = false;

            if (shape is RealPoint)
            {
                output = PolygonWithRealPoint.Cross(this, shape as RealPoint);
            }
            else if (shape is Segment)
            {
                output = PolygonWithSegment.Cross(this, shape as Segment);
            }
            else if (shape is Polygon)
            {
                output = PolygonWithPolygon.Cross(this, shape as Polygon);
            }
            else if (shape is Circle)
            {
                output = PolygonWithCircle.Cross(this, shape as Circle);
            }
            else if (shape is Line)
            {
                output = PolygonWithLine.Cross(this, shape as Line);
            }

            return(output);
        }
コード例 #3
0
ファイル: Polygon.cs プロジェクト: Omybot/GoBot
        /// <summary>
        /// Retourne la distance minimum entre le polygone courant et la forme donnée
        /// </summary>
        /// <param name="shape">Forme testée</param>
        /// <returns>Distance minimum entre le polygone et la forme donnée</returns>
        public double Distance(IShape shape)
        {
            double output = 0;

            if (shape is RealPoint)
            {
                output = PolygonWithRealPoint.Distance(this, shape as RealPoint);
            }
            else if (shape is Segment)
            {
                output = PolygonWithSegment.Distance(this, shape as Segment);
            }
            else if (shape is Polygon)
            {
                output = PolygonWithPolygon.Distance(this, shape as Polygon);
            }
            else if (shape is Circle)
            {
                output = PolygonWithCircle.Distance(this, shape as Circle);
            }
            else if (shape is Line)
            {
                output = PolygonWithLine.Distance(this, shape as Line);
            }

            return(output);
        }