Package com.sromku.polygon

Examples of com.sromku.polygon.Point


   * Create simple polygon and check that the point is inside
   */
  public static void testSimplePolygon()
  {
    Polygon polygon = Polygon.Builder()
        .addVertex(new Point(1, 3))
        .addVertex(new Point(2, 8))
        .addVertex(new Point(5, 4))
        .addVertex(new Point(5, 9))
        .addVertex(new Point(7, 5))
        .addVertex(new Point(6, 1))
        .addVertex(new Point(3, 1))
        .build();
   
    // Point is inside
    isInside(polygon, new Point(5.5f, 7));
   
    // Point isn't inside
    isInside(polygon, new Point(4.5f, 7));
  }
View Full Code Here


   * Create polygon two holes and check that the point is inside
   */
  public static void testPolygonWithHoles()
  {
    Polygon polygon = Polygon.Builder()
        .addVertex(new Point(1, 2)) // polygon
        .addVertex(new Point(1, 6))
        .addVertex(new Point(8, 7))
        .addVertex(new Point(8, 1))
        .close()
        .addVertex(new Point(2, 3)) // hole one
        .addVertex(new Point(5, 5))
        .addVertex(new Point(6, 2))
        .close()
        .addVertex(new Point(6, 6)) // hole two
        .addVertex(new Point(7, 6))
        .addVertex(new Point(7, 5))
        .build();
   
    // Point is inside
    isInside(polygon, new Point(6, 5));
   
    // Point isn't inside
    isInside(polygon, new Point(4, 3));
   
    // Point isn't inside
    isInside(polygon, new Point(6.5f, 5.8f));
  }
View Full Code Here

TOP

Related Classes of com.sromku.polygon.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.