Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4096608

Polygon.contains(int,int) works incorrectly for some boundary points.

XMLWordPrintable

    • 2d
    • 1.2.2
    • sparc
    • solaris_2.5



      Name: aaC67449 Date: 12/03/97




      Polygon.contains(int,int) works incorrectly for some boundary points. In some case it returns true, in another false.
      -------------Example ---------------

      import java.awt.*;

      public class Test {

      public static void main( String argv[] ) {
         int x[]={0,0,3,2};
         int y[]={0,3,3,2};
         Polygon p=new Polygon(x,y,4);
         if(p.contains(0,1))
            System.out.println("FAILED.Polygon contains point [0,1]");
         else
            System.out.println("Polygon doesn't contain point [0,1]");
          if(p.contains(1,1))
            System.out.println("FAILED.Polygon contains point [1,1]");
         else
            System.out.println("Polygon doesn't contain point [1,1]");
      }

      }
      ---------Output from the test---------------------
      Polygon doesn't contain point [0,1]
      FAILED.Polygon contains point [1,1]
      --------------------------------------------------



      ======================================================================

            flar Jim Graham
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: