Beispiel #1
0
        public void Protected_FindEar()
        {
            AXYPolygon p1 = new AXYPolygon();

            p1.Points.Add(new XYPoint(0, 3));
            p1.Points.Add(new XYPoint(3, 0));
            p1.Points.Add(new XYPoint(8, 0));
            p1.Points.Add(new XYPoint(8, 2));
            p1.Points.Add(new XYPoint(3, 1));
            p1.Points.Add(new XYPoint(3, 3));
            p1.Points.Add(new XYPoint(8, 3));
            p1.Points.Add(new XYPoint(4, 7));
            Assert.AreEqual(2, p1.AFindEar(), "Test1");
        }
Beispiel #2
0
        public void Protected_IsIntersected()
        {
            AXYPolygon p1 = new AXYPolygon();

            p1.Points.Add(new XYPoint(0, 3));
            p1.Points.Add(new XYPoint(3, 0));
            p1.Points.Add(new XYPoint(8, 0));
            p1.Points.Add(new XYPoint(8, 2));
            p1.Points.Add(new XYPoint(3, 1));
            p1.Points.Add(new XYPoint(3, 3));
            p1.Points.Add(new XYPoint(8, 3));
            p1.Points.Add(new XYPoint(4, 7));
            Assert.AreEqual(true, p1.AIsIntersected(0), "Test1");
            Assert.AreEqual(true, p1.AIsIntersected(1), "Test2");
            Assert.AreEqual(false, p1.AIsIntersected(2), "Test3");
        }
Beispiel #3
0
        public void Protected_IsConvex()
        {
            AXYPolygon xypolygon4 = new AXYPolygon();

            xypolygon4.Points.Add(new XYPoint(1, 1));
            xypolygon4.Points.Add(new XYPoint(9, 1));
            xypolygon4.Points.Add(new XYPoint(5, 5));
            xypolygon4.Points.Add(new XYPoint(5, 3));
            xypolygon4.Points.Add(new XYPoint(3, 3));
            xypolygon4.Points.Add(new XYPoint(3, 8));
            xypolygon4.Points.Add(new XYPoint(9, 8));
            xypolygon4.Points.Add(new XYPoint(9, 11));
            xypolygon4.Points.Add(new XYPoint(1, 11));

            Assert.AreEqual(true, xypolygon4.AIsConvex(0));
            Assert.AreEqual(true, xypolygon4.AIsConvex(1));
            Assert.AreEqual(true, xypolygon4.AIsConvex(2));
            Assert.AreEqual(false, xypolygon4.AIsConvex(3));
            Assert.AreEqual(false, xypolygon4.AIsConvex(4));
            Assert.AreEqual(false, xypolygon4.AIsConvex(5));
            Assert.AreEqual(true, xypolygon4.AIsConvex(6));
            Assert.AreEqual(true, xypolygon4.AIsConvex(7));
            Assert.AreEqual(true, xypolygon4.AIsConvex(8));
        }
    public void Protected_IsConvex()
    {
      AXYPolygon xypolygon4 = new AXYPolygon();
      xypolygon4.Points.Add(new XYPoint(1,1));
      xypolygon4.Points.Add(new XYPoint(9,1));
      xypolygon4.Points.Add(new XYPoint(5,5));
      xypolygon4.Points.Add(new XYPoint(5,3));
      xypolygon4.Points.Add(new XYPoint(3,3));
      xypolygon4.Points.Add(new XYPoint(3,8));
      xypolygon4.Points.Add(new XYPoint(9,8));
      xypolygon4.Points.Add(new XYPoint(9,11));
      xypolygon4.Points.Add(new XYPoint(1,11));
		
      Assert.AreEqual( true, xypolygon4.AIsConvex(0));
      Assert.AreEqual( true, xypolygon4.AIsConvex(1));
      Assert.AreEqual( true, xypolygon4.AIsConvex(2));
      Assert.AreEqual( false, xypolygon4.AIsConvex(3));
      Assert.AreEqual( false, xypolygon4.AIsConvex(4));
      Assert.AreEqual( false, xypolygon4.AIsConvex(5));
      Assert.AreEqual( true, xypolygon4.AIsConvex(6));
      Assert.AreEqual( true, xypolygon4.AIsConvex(7));
      Assert.AreEqual( true, xypolygon4.AIsConvex(8));
    }
 public void Protected_IsIntersected()
 {
   AXYPolygon p1 = new AXYPolygon();
   p1.Points.Add(new XYPoint(0, 3));
   p1.Points.Add(new XYPoint(3, 0));
   p1.Points.Add(new XYPoint(8, 0));
   p1.Points.Add(new XYPoint(8, 2));
   p1.Points.Add(new XYPoint(3, 1));
   p1.Points.Add(new XYPoint(3, 3));
   p1.Points.Add(new XYPoint(8, 3));
   p1.Points.Add(new XYPoint(4, 7));
   Assert.AreEqual(true, p1.AIsIntersected(0),"Test1");     
   Assert.AreEqual(true, p1.AIsIntersected(1),"Test2");     
   Assert.AreEqual(false, p1.AIsIntersected(2),"Test3");     
 }
 public void Protected_FindEar()
 {
   AXYPolygon p1 = new AXYPolygon();
   p1.Points.Add(new XYPoint(0, 3));
   p1.Points.Add(new XYPoint(3, 0));
   p1.Points.Add(new XYPoint(8, 0));
   p1.Points.Add(new XYPoint(8, 2));
   p1.Points.Add(new XYPoint(3, 1));
   p1.Points.Add(new XYPoint(3, 3));
   p1.Points.Add(new XYPoint(8, 3));
   p1.Points.Add(new XYPoint(4, 7));
   Assert.AreEqual(2, p1.AFindEar(),"Test1");
 }