Example #1
0
 public void setPoints(int[][] points)
 {
     if (points.Length == 3)
     {
         for (int i = 0; i < points.Length; i++)
         {
             //Set point
             if (i == 0 && points[0].Length == 2)
             {
                 PointOne.setPoint(points[0][0], points[0][1]);
             }
             if (i == 1 && points[1].Length == 2)
             {
                 PointTwo.setPoint(points[1][0], points[1][1]);
             }
             if (i == 2 && points[2].Length == 2)
             {
                 PointThree.setPoint(points[2][0], points[2][1]);
             }
         }
         setSides();
         SetSortedSides();
         setAngles();
     }
 }
Example #2
0
 public void TestIfTriangle()
 {
     Console.Write($"Triangle: ");
     PointOne.print();
     PointTwo.print();
     PointThree.print();
     Console.WriteLine();
     //Test if triangle
     if (!isTriangle())
     {
         Console.WriteLine("Not a triangle.");
         return;
     }
     //Test if right triangle
     if (isRightTriangle())
     {
         Console.WriteLine("Is a right triangle.");
     }
     //Test if acute triangle
     if (isAcute())
     {
         Console.WriteLine("Is an acute triangle.");
     }
     //Test if acute triangle
     if (isObtuse())
     {
         Console.WriteLine("Is an obtuse triangle.");
     }
     //Test if isosceles triangle
     if (isIsosceles())
     {
         Console.WriteLine("Is an isosceles triangle.");
     }
     //Test if equilateral triangle
     if (isEquilateral())
     {
         Console.WriteLine("Is an equilateral triangle.");
     }
 }
Example #3
0
 private void setSides()
 {
     SideOne   = Math.Abs(PointOne.dist(PointTwo));
     SideTwo   = Math.Abs(PointOne.dist(PointThree));
     SideThree = Math.Abs(PointThree.dist(PointTwo));
 }