Пример #1
0
        /// <summary>
        /// initialize a rectangle through two or four sides and other skin figure.
        /// </summary>
        /// <param name="sidesCollection">Two or four sides</param>
        /// <param name="figure">Other skin figure</param>
        public RectanglePellicle(IEnumerable <double> sidesCollection, IPellicleFigure figure) : base(sidesCollection)
        {
            double area = Sides[0] * Sides[1];

            if (area > figure.GetArea())
            {
                throw new ArgumentException();
            }
        }
Пример #2
0
        /// <summary>
        /// initialize a square through one or three sides and other skin figure.
        /// </summary>
        /// <param name="sidesCollection">Three sides</param>
        /// <param name="figure">Other skin figure</param>
        public TrianglePellicle(IEnumerable <double> sidesCollection, IPellicleFigure figure) : base(sidesCollection)
        {
            double area = Math.Sqrt((Sides.Sum() / 2) * ((Sides.Sum() / 2) - Sides[0]) * ((Sides.Sum() / 2) - Sides[1]) * ((Sides.Sum() / 2) - Sides[2]));

            if (area > figure.GetArea())
            {
                throw new ArgumentException();
            }
        }
Пример #3
0
        /// <summary>
        /// initialize a circle through a radius and a other skin figure.
        /// </summary>
        /// <param name="radius">Cicle radius</param>
        /// /// <param name="figure">Other skin figure</param>
        public CirclePellicle(double radius, IPellicleFigure figure) : base(radius)
        {
            double area = Math.PI * Math.Pow(Radius, 2);

            if (area > figure.GetArea())
            {
                throw new ArgumentException();
            }
        }