Package purrpackagedemo

Examples of purrpackagedemo.Point


  @Test
  public void testContains() {
    Region s1 = Polygon.UNIT_SQUARE;
    Region s2 = new Transformation.Translation( .5, .5 ).apply( s1 );
    Union u = new Union( s1, s2 );
    assertTrue( u.contains( new Point( 0.5, 0.5 )));
    assertTrue( u.contains( new Point( 0.25, 0.25 )));
    assertTrue( u.contains( new Point( 1.25, 1.25 )));
    assertFalse( u.contains( new Point( .25, 1.25 )));
    assertFalse( u.contains( new Point( 7, 7 )));
  }
View Full Code Here


  @Test
  public void testContains() {
    Region s1 = Region.UPPER_HALF_PLANE;
    Region s2 = Circle.UNIT;
    Region r = new Complement( s1, s2 );
    for ( Point p : new Point[] { new Point( .25, .25 ), new Point( .25, 3 ) } ) {
      assertEquals( s2.contains( p ), !r.contains( p ));
    }
    assertFalse( r.contains( new Point( 0, -2 )) );
  }
View Full Code Here

  @Test
  public void testContains() {
    Transformation t = new Transformation.Translation( 0.5, 0.5 );
    Intersection r = new Intersection( Polygon.UNIT_SQUARE, t.apply( Polygon.UNIT_SQUARE ) );
    assertFalse( r.contains( Point.ORIGIN ));
    assertTrue( r.contains( new Point( 0.75, 0.75 )));
    assertFalse( r.contains( new Point( .75, .25 )));
    assertFalse( r.contains( new Point( .25, .25 )));
    assertFalse( r.contains( new Point( .25, .65 )));
  }
View Full Code Here

  static Polygon tri, square;
 
  @BeforeClass
  public static void setup() {
    tri = new Polygon( new Point( -1, -1 ), new Point( 0, 1 ), new Point( 1, -1 ) );
    square = new Polygon( new Point( -1, -1 ), new Point( -1, 1 ), new Point( 1, 1 ), new Point( 1, -1 ) );
  }
View Full Code Here

  }
 
  @Test
  public void testTriangle() {
    Assert.assertTrue( tri.contains( Point.ORIGIN ));
    Assert.assertTrue( tri.contains( new Point( 0, 0.5 ) ));
    Assert.assertFalse( tri.contains( new Point( 3,3 )));
    Assert.assertFalse( tri.contains( new Point( .05, 1 )));
    Assert.assertFalse( tri.contains( new Point( 0, 1.05 )));
    Assert.assertFalse( tri.contains( new Point( -1, -2 )));
    Assert.assertFalse( tri.contains( new Point( -1, 2 )));
    Assert.assertTrue( tri.contains( new Point( -.999, -1 )));
  }
View Full Code Here

  }
 
  @Test
  public void testSquare() {
    Assert.assertTrue( square.contains( Point.ORIGIN ));
    Assert.assertTrue( square.contains( new Point( 0.5, 0.5 )));
    Assert.assertFalse( square.contains( new Point( 0, 2 )));
    Assert.assertFalse( square.contains( new Point( 1, 3 )) );
  }
View Full Code Here

TOP

Related Classes of purrpackagedemo.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.