public void TestIsAcute()
        {
            Assert.AreEqual(AngleUtility.IsAcute(new Coordinate(10, 0), new Coordinate(0, 0), new Coordinate(5, 10)), true);
            Assert.AreEqual(AngleUtility.IsAcute(new Coordinate(10, 0), new Coordinate(0, 0), new Coordinate(5, -10)), true);
            // angle of 0
            Assert.AreEqual(AngleUtility.IsAcute(new Coordinate(10, 0), new Coordinate(0, 0), new Coordinate(10, 0)), true);

            Assert.AreEqual(AngleUtility.IsAcute(new Coordinate(10, 0), new Coordinate(0, 0), new Coordinate(-5, 10)), false);
            Assert.AreEqual(AngleUtility.IsAcute(new Coordinate(10, 0), new Coordinate(0, 0), new Coordinate(-5, -10)), false);
        }
Beispiel #2
0
 /// <summary>
 /// Tests whether a triangle is acute. A triangle is acute iff all interior
 /// angles are acute. This is a strict test - right triangles will return
 /// <tt>false</tt> A triangle which is not acute is either right or obtuse.
 /// <para/>
 /// Note: this implementation is not robust for angles very close to 90 degrees.
 /// </summary>
 /// <param name="a">A vertex of the triangle</param>
 /// <param name="b">A vertex of the triangle</param>
 /// <param name="c">A vertex of the triangle</param>
 /// <returns>True if the triangle is acute.</returns>
 public static Boolean IsAcute(Coordinate a, Coordinate b, Coordinate c)
 {
     if (!AngleUtility.IsAcute(a, b, c))
     {
         return(false);
     }
     if (!AngleUtility.IsAcute(b, c, a))
     {
         return(false);
     }
     if (!AngleUtility.IsAcute(c, a, b))
     {
         return(false);
     }
     return(true);
 }