Package rlforj.math

Examples of rlforj.math.Point2I


  }
 
  public void testDiagonalWall() {
    TestBoard b = new TestBoard(false);
   
    b.exception.add(new Point2I(11, 11));
    b.exception.add(new Point2I(10, 10));
   
    a.visitFieldOfView(b, 10, 11, 5);
//    b.print(5, 15, 6, 16);
//    System.out.println();
   
    assertTrue(b.visited.contains(new Point2I(11, 10)));
  }
View Full Code Here


  public void testLarge() {
    TestBoard b = new TestBoard(false);
   
    Random rand=new Random();
    for(int i=0; i<100; i++)
      b.exception.add(new Point2I(rand.nextInt(81)+60, rand.nextInt(81)+60));
   
    long t1=System.currentTimeMillis();
    a.visitFieldOfView(b, 100, 100, 40);
    long t2=System.currentTimeMillis();
   
View Full Code Here

  {
    Random rand = new Random();
    TestBoard tb = new TestBoard(false);
   
    for(int i=0; i<50; i++) {
      tb.exception.add(new Point2I(rand.nextInt(21), rand.nextInt(21)));
    }
   
    int x1=rand.nextInt(21), y1=rand.nextInt(21);
//    int x1=45, y1=10;
//    tb.exception.add(new Point2I(7, 11));
View Full Code Here

 
  public void testLine() {
    TestBoard b = new TestBoard(true);
   
    for(int i=5; i<11; i++)
      b.exception.add(new Point2I(i, 10));
   
//    b.print(5, 15, 5, 15);
//    System.out.println();
   
    assertTrue(a.existsLineOfSight(b, 10, 10, 11, 11, false));
View Full Code Here

  }
 
  public void testAcrossPillar() {
    TestBoard b = new TestBoard(false);
   
    b.exception.add(new Point2I(10, 10));
   
//    b.print(4, 14, 4, 14);
//    System.out.println();
   
    assertTrue(a.existsLineOfSight(b, 9, 9, 10, 11, false));
View Full Code Here

  }
 
  public void testDiagonalWall() {
    TestBoard b = new TestBoard(false);
   
    b.exception.add(new Point2I(11, 11));
    b.exception.add(new Point2I(10, 10));
   
//    b.print(5, 15, 6, 16);
//    System.out.println();
    assertTrue(a.existsLineOfSight(b, 10, 11, 11, 10, false));
   
View Full Code Here

  private int dsq;
 
  public void visitFieldOfView(ILosBoard b, int x, int y, int distance)
  {
    this.world = b;
    this.origin = new Point2I(x, y);
    this.perimeter = new LinkedList<RayData>();
    this.results = new RayData[2*distance+1][2*distance+1];
   
    offset = new Point2I(distance, distance);
    dsq=distance*distance;
    b.visit(x, y);
    castRays();
//    printResults();
  }
View Full Code Here

//    printResults();
  }
 
  public MultiRaysCaster(ILosBoard world, int originX, int originY, int radius) {
    this.world = world;
    this.origin = new Point2I(originX, originY);
    this.perimeter = new LinkedList<RayData>();
    this.results = new RayData[2*radius+1][2*radius+1];
   
    offset = new Point2I(radius, radius);
    dsq=radius*radius;
  }
 
View Full Code Here

  }
 
  public static void main(String[] args)
  {
    TestBoard1 b=new TestBoard1(false);
    b.exception.add(new Point2I(11, 11));
    b.exception.add(new Point2I(7, 8));
    MultiRaysCaster m=new MultiRaysCaster();
    m.visitFieldOfView(b, 10, 10, 10);
    System.out.println(b.obsNotVisited);
    b.mark(10, 10, '@');
    b.print(0, 20, 0, 20);
View Full Code Here

    @Override
    public void visit(int x, int y)
    {
      super.visit(x, y);
      System.out.println("Visiting "+x+" "+y);
      obsNotVisited.remove(new Point2I(x, y));
    }
View Full Code Here

TOP

Related Classes of rlforj.math.Point2I

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.