Package purrpackagedemo

Examples of purrpackagedemo.Point


  static Polygon tri, square;
 
  @BeforeSuite
  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 testSpecialCases() {
    // it doesn't even check, for better or worse.
    assertFalse( new Polygon( Point.ORIGIN ).contains( null ));
    assertFalse( tri.contains( new Point( -100, -100 )));
    assertTrue( tri.isBetween( 2, 1, 3 ));
    assertTrue( tri.isBetween( 2, 3, 1 ));
    assertFalse( tri.isBetween( 4, 1, 3 ));
    assertFalse( tri.isBetween( 4, 3, 1 ));
  }
View Full Code Here

  }

  @Test
  public void testArgumentCheckinUsingJUnitThreeConvention() {
    try {
      Circle c = new Circle(new Point(1, 1), -1);
      fail(c.toString());
    } catch (IllegalArgumentException e) {
    }
    try {
      Circle c = new Circle(null, 0);
View Full Code Here

// PurrPackage recognizes old and new style JUnit conventions.
public class EllipseTest extends TestCase {
  Ellipse e;

  public void setUp() {
    e = new Ellipse( new Point( -1, 0 ), new Point( 1, 0), 4 );
  }
View Full Code Here

    e = new Ellipse( new Point( -1, 0 ), new Point( 1, 0), 4 );
  }

  public void testContains() {
    assertTrue( e.contains( Point.ORIGIN ));
    assertTrue( e.contains( new Point( 1, 1 )));
  }
View Full Code Here

    if (points.size() < 3) {
      return false;
    }
    int segmentsIntersectingToTheLeft = 0;
    Iterator<Point> i = points.iterator();
    Point prev = i.next();
    while (i.hasNext()) {
      Point current = i.next();
      if (rightOfIntersection(p, prev, current)) {
        ++segmentsIntersectingToTheLeft;
      }
    }
    return segmentsIntersectingToTheLeft % 2 != 0;
View Full Code Here

  }
 
  @Test
  public void testTransformationsOnPoints() {
    Translation t = new Translation( 3, -2.5 );
    assertPointEquals( new Point( 3, -2.5 ), t.apply( Point.ORIGIN ));
    assertPointEquals( new Point( 4, -1.5 ), t.apply( new Point( 1, 1 ) ) );
   
    Rotation r = new Rotation( Math.PI / 2.0 );
    assertPointEquals( new Point( 0, 1 ), r.apply( new Point( 1, 0 )) );
    assertPointEquals( new Point( -2, 0 ), r.apply( r.apply( new Point( 2, 0 ))) );
   
    Expansion z = new Expansion( -2 );
    assertPointEquals( new Point( 14, -16 ), z.apply( new Point( -7, 8 )) );
  }
View Full Code Here

    assertPointEquals( new Point( 14, -16 ), z.apply( new Point( -7, 8 )) );
  }

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

public class StrayEllipseTest extends Assert {

  @Test
  public void testWhatever() {
   
    assertFalse( new Ellipse( Point.ORIGIN, new Point( 1, 1 ), 3 ).contains( new Point( 7, 7 )));
    try {
      Ellipse e = new Ellipse( Point.ORIGIN, null, 1 );
      fail(e.toString());
    } catch (IllegalArgumentException e) {
    }
View Full Code Here

    }
  }
 
  @Test
  public void testAccidentally() {
    Point p = new Point( 0, -1 );
    Rotation r = new Rotation( Math.PI / 2);
    System.out.println( r.apply( p ));
   

  }
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.