Exemple #1
0
        /// <summary>
        /// Retourne la distance minimale entre la Droite et la forme donnée
        /// </summary>
        /// <param name="shape">IForme testée</param>
        /// <returns>Distance minimale</returns>
        public virtual double Distance(IShape shape)
        {
            double output = 0;

            if (shape is RealPoint)
            {
                output = LineWithRealPoint.Distance(this, shape as RealPoint);
            }
            else if (shape is Segment)
            {
                output = LineWithSegment.Distance(this, shape as Segment);
            }
            else if (shape is Polygon)
            {
                output = LineWithPolygon.Distance(this, shape as Polygon);
            }
            else if (shape is Circle)
            {
                output = LineWithCircle.Distance(this, shape as Circle);
            }
            else if (shape is Line)
            {
                output = LineWithLine.Distance(this, shape as Line);
            }

            return(output);
        }