Ejemplo n.º 1
0
 /// <summary>
 /// Define weather the triangle is right
 /// </summary>
 /// <returns>True, if triangle is right</returns>
 public bool IsRight()
 {
     if (SideA.Equals(Math.Pow(SideB * SideB + SideC * SideC, 0.5)) ||
         SideB.Equals(Math.Pow(SideA * SideA + SideC * SideC, 0.5)) ||
         SideC.Equals(Math.Pow(SideB * SideB + SideA * SideA, 0.5)))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Determines whether the specified object is equal to the current object.
        /// </summary>
        /// <param name="obj"> The object to compare with the current object.</param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            Triangle tr = obj as Triangle;

            if (tr == null)
            {
                return(false);
            }

            return(SideA.Equals(tr.SideA) && SideB.Equals(tr.SideB) && SideC.Equals(tr.SideC));
        }
 public bool IsRightTriangle()
 {
     return(SideA.Equals(Math.Sqrt(Math.Pow(SideB, 2) + Math.Pow(SideC, 2))) ||
            SideB.Equals(Math.Sqrt(Math.Pow(SideA, 2) + Math.Pow(SideC, 2))) ||
            SideC.Equals(Math.Sqrt(Math.Pow(SideA, 2) + Math.Pow(SideB, 2))));
 }