Package wolf.util

Examples of wolf.util.Turtle.move()


    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);
    ta.angle = ang - 90;
    ta.move(collisionGeometryWidth);
    coords[5] = new Coordinate(ta.pos);
   
View Full Code Here


    coords[6] = coords[0]; //first element is also last
    ta.turn(collisionGeometryAngle);
    ta.move(length);
    coords[1] = new Coordinate(ta.pos);
    ta.angle = ang - 90;
    ta.move(collisionGeometryWidth);
    coords[5] = new Coordinate(ta.pos);
   
    Turtle tb = new Turtle(b.pos, ang+180);
    tb.move(minimumRoadLength*.9);
    coords[3] = new Coordinate(tb.pos); //end point
View Full Code Here

    ta.angle = ang - 90;
    ta.move(collisionGeometryWidth);
    coords[5] = new Coordinate(ta.pos);
   
    Turtle tb = new Turtle(b.pos, ang+180);
    tb.move(minimumRoadLength*.9);
    coords[3] = new Coordinate(tb.pos); //end point
    tb.turn(collisionGeometryAngle);
    tb.move(length);
    coords[4] = new Coordinate(tb.pos);
    tb.angle = ang - 90;
View Full Code Here

   
    Turtle tb = new Turtle(b.pos, ang+180);
    tb.move(minimumRoadLength*.9);
    coords[3] = new Coordinate(tb.pos); //end point
    tb.turn(collisionGeometryAngle);
    tb.move(length);
    coords[4] = new Coordinate(tb.pos);
    tb.angle = ang - 90;
    tb.move(collisionGeometryWidth);
    coords[2] = new Coordinate(tb.pos);
   
View Full Code Here

    coords[3] = new Coordinate(tb.pos); //end point
    tb.turn(collisionGeometryAngle);
    tb.move(length);
    coords[4] = new Coordinate(tb.pos);
    tb.angle = ang - 90;
    tb.move(collisionGeometryWidth);
    coords[2] = new Coordinate(tb.pos);
   
    Polygon p = gf.createPolygon(gf.createLinearRing(coords), null);
   
    return p;
View Full Code Here

        //invalid direction
        break;
      }

      t.angle = angle;
      t.move((float)roadLength);
     
      returnRoad = new Road(road.b, new Intersection(new Coordinate(t.pos)), nextRoadType, new Basic(c), road);
    }
    return returnRoad;
  }
View Full Code Here

        //invalid direction
        break;
      }

      t.angle = angle;
      t.move((float)roadLength);
      float population = city.pop.get((int)t.pos.x, (int)t.pos.y);
      if(population>=bestPopulation ){ //&& water < .7
        bestPopulation = population;
        bestPosition = new Coordinate(t.pos);
      }
View Full Code Here

      t = new Turtle(road.b.pos, 0);
      angle = RandomHelper.random(city.random.nextFloat(), 20, -20);
      nextRoadType = RoadType.HIGHWAY;
      double roadLength = Math.abs(Math.sin(Math.toRadians((previousAngle-angle)%360))*nextRoadLength); //sin approximates how long next road should be
      t.angle = angle;
      t.move((float)roadLength);
      returnRoad = new Road(road.b, new Intersection(new Coordinate(t.pos)), nextRoadType, this, road); //roads set to default should die.
    }else{
      returnRoad = new Road(road.b, new Intersection(bestPosition), nextRoadType, this, road); //roads set to default should die.
    }
    return returnRoad;
View Full Code Here

      double angle = (Math.floor((previousAngle+45)/90)*90+direction);
      t = new Turtle(r.a.pos, angle);//+((city.random.nextDouble()-.5)*20));
    }
    switch(d){
    case FORWARD:{
      t.move(roadLength(t.angle));
      r.b.pos = t.pos;
      return r;
    }
    case BACKWARD:{
      t.move(-roadLength(t.angle));
View Full Code Here

      t.move(roadLength(t.angle));
      r.b.pos = t.pos;
      return r;
    }
    case BACKWARD:{
      t.move(-roadLength(t.angle));
      r.b.pos = t.pos;
      return r;
    }
    case LEFT:{
      t.turn(90);
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.