Package wolf.util

Examples of wolf.util.Turtle.move()


      }
      Coordinate startPoint = new Coordinate(x,y);
      double angle = Math.toDegrees(Angle.angle(startPoint, new Coordinate(0,0)));
      Turtle t = new Turtle(startPoint, angle);
      //t.turn(45);
      t.move(32);
      roadQueue.add(new Road(new Intersection(startPoint), new Intersection(t.pos), RoadType.HIGHWAY, basicRule));
    }
    int highwayCount = Math.max((city.sizeX*2+city.sizeY*2)/(3*1024),1);
    for(int i=0; i<highwayCount; i++){
      //highway from random side
View Full Code Here


      case 0:{ //North
        log.log("Highway from the north");
        float x = (float) ((this.city.random.nextFloat()-.5)*city.sizeX); //can place in center half of city
        Coordinate startPoint = new Coordinate(x, city.sizeY/2);
        Turtle t = new Turtle(startPoint, ((city.random.nextDouble()*180)%seedHighwayAngleSize)+270);
        t.move(length);
        roadQueue.add(new Road(new Intersection(startPoint), new Intersection(t.pos), RoadType.HIGHWAY, basicRule));
        break;
      }
      case 1:{ //South
        log.log("Highway from the south");
View Full Code Here

      case 1:{ //South
        log.log("Highway from the south");
        float x = (float) ((this.city.random.nextFloat()-.5)*city.sizeX); //can place in center half of city
        Coordinate startPoint = new Coordinate(x, -city.sizeY/2);
        Turtle t = new Turtle(startPoint, ((city.random.nextDouble()*180)%seedHighwayAngleSize)+90);
        t.move(length);
        roadQueue.add(new Road(new Intersection(startPoint), new Intersection(t.pos), RoadType.HIGHWAY, basicRule));
        break;
      }
      case 2:{ //East
        log.log("Highway from the east");
View Full Code Here

      case 2:{ //East
        log.log("Highway from the east");
        float y = (float) ((this.city.random.nextFloat()-.5)*city.sizeY);
        Coordinate startPoint = new Coordinate(-city.sizeX/2, y);
        Turtle t = new Turtle(startPoint, ((city.random.nextDouble()*180)%seedHighwayAngleSize)+0);
        t.move(length);
        roadQueue.add(new Road(new Intersection(startPoint), new Intersection(t.pos), RoadType.HIGHWAY, basicRule));
        break;
      }
      case 3:{ //West
        log.log("Highway from the west");
View Full Code Here

      case 3:{ //West
        log.log("Highway from the west");
        float y = (float) ((this.city.random.nextFloat()-.5)*city.sizeY);
        Coordinate startPoint = new Coordinate(city.sizeX/2, y);
        Turtle t = new Turtle(startPoint, ((city.random.nextDouble()*180)%seedHighwayAngleSize)+180);
        t.move(length);
        roadQueue.add(new Road(new Intersection(startPoint), new Intersection(t.pos), RoadType.HIGHWAY, basicRule));
        break;
      }
      default:{
        System.out.println("You done goofed. Check the seedRoadMap function's direction variable");
View Full Code Here

          Turtle t1 = new Turtle(t0.pos, t0.angle);
          //move out to sides of roads
          t0.turn(90);
          t1.turn(-90);
          t0.move(radius);
          t1.move(radius);
          Coordinate t0Start = new Coordinate(t0.pos);
          Coordinate t1Start = new Coordinate(t1.pos);
          //return to first orientation
          t0.turn(-90);
          t1.turn(90);
View Full Code Here

          Coordinate t1Start = new Coordinate(t1.pos);
          //return to first orientation
          t0.turn(-90);
          t1.turn(90);
          t0.move(r.width*6);
          t1.move(r.width*6);
         
          LineSegment ls0 = new LineSegment(t0Start, t0.pos);
          LineSegment ls1 = new LineSegment(t1Start, t1.pos);
          segments0.add(ls0);
          segments1.add(ls1);
View Full Code Here

          }else{
            t0 = new Turtle(is.pos, Math.toDegrees(Angle.angle(is.pos, r.a.pos)));
          }
         
          //move out from intersection and split into road width
          t0.move(extrusion[j]);
          t0.turn(90);
          Turtle t1 = new Turtle(t0.pos, t0.angle-180);
          t0.move(radius);
          t1.move(radius);
         
View Full Code Here

          //move out from intersection and split into road width
          t0.move(extrusion[j]);
          t0.turn(90);
          Turtle t1 = new Turtle(t0.pos, t0.angle-180);
          t0.move(radius);
          t1.move(radius);
         
          segments[j] = new LineSegment(t0.pos, t1.pos);
        }
        //need to sort segments by angle order, then use that to generate shape. Convex hull will not work.
       
View Full Code Here

    Coordinate[] coords = new Coordinate[7];
   
    double ang = Math.toDegrees(Angle.angle(a.pos, b.pos));
   
    Turtle ta = new Turtle(a.pos, ang);
    ta.move(minimumRoadLength*.9);
    coords[0] = new Coordinate(ta.pos); //start point
    coords[6] = coords[0]; //first element is also last
    ta.turn(collisionGeometryAngle);
    ta.move(length);
    coords[1] = new Coordinate(ta.pos);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.