Package purrpackagedemo

Examples of purrpackagedemo.Region


  public void testTransformationsOnRegions() {
    Point[] ps = new Point[] { Point.ORIGIN, new Point( 0.5, -0.5 ), new Point( 1, 1 ) };
    Transformation[] ts = new Transformation[] { new Transformation.Expansion( 2.0 ),
        new Transformation.Rotation( 1 ), new Translation( 7, -8 ) };
    for( Transformation t : ts ) {
      Region tr = t.apply( Circle.UNIT );
      for ( Point p : ps ) {
        assertEquals( Circle.UNIT.contains( p ), tr.contains( t.apply( p )) );
      }
    }
   
   
  }
View Full Code Here


public class TestUnion extends TestCase {

  @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 )));
View Full Code Here

public class TestComplement extends TestCase {

  @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

TOP

Related Classes of purrpackagedemo.Region

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.