cureos / aforge

PCL version of AForge.NET Framework, https://code.google.com/p/aforge/
Other
125 stars 96 forks source link

shapeChecker.IsConvexPolygon: long thin rectangle is not a convex polygon #24

Closed HNeukermans closed 7 years ago

HNeukermans commented 7 years ago

executing following test fails: It's about a long thin rectangle 50 high and 1000 wide.

2 bugs:

 public class SimpleShapeCheckerTest
{
        private List<IntPoint> rectangledTriangle = new List<IntPoint>();
        public SimpleShapeCheckerTest()
        {
            longThinRectangle.Add(new IntPoint(0, 0)); //corner
            longThinRectangle.Add(new IntPoint(20, 0));
            longThinRectangle.Add(new IntPoint(40, 0));
            longThinRectangle.Add(new IntPoint(50, 0)); //corner
            longThinRectangle.Add(new IntPoint(50, 100));
            longThinRectangle.Add(new IntPoint(50, 500));
            longThinRectangle.Add(new IntPoint(50, 1000)); // corner
            longThinRectangle.Add(new IntPoint(25, 1000));
            longThinRectangle.Add(new IntPoint(0, 1000));
            longThinRectangle.Add(new IntPoint(0, 500));
         }

         [TestMethod]
        public void IsConvexPolygon()
        {
            List<IntPoint> corners;
            Assert.AreEqual(true, shapeChecker.IsConvexPolygon(rectangle, out corners));
            Assert.AreEqual(4, corners.Count);
        }
anders9ustafsson commented 7 years ago

@HNeukermans Thanks for reporting. I assume this is not specific to the portable AForge libraries, but rather a general AForge.NET Framework problem? For the most informed response, I recommend that you post this issue to the main AForge.NET Framework Github repository instead, or possibly even the Accord.NET Framework.

HNeukermans commented 7 years ago

opened issue at AForge.NET Framework. Thx @anders9ustafsson