Package ds.moteur.route.cc

Examples of ds.moteur.route.cc.CourbeConduite


    Point p = voitureJoueur.getPositionAvant();
    for(Section s : terrain.getSections()){
      if(s.getFrontiere().isInside(p)){
        double distance = 1000;
        double abscisse = 0;
        CourbeConduite ccRetenue = null;
        for(CourbeConduite cc : s.getCourbesConduites()){
          double distanceCC = cc.getDistance(p)[0];
          double abscisseCC = cc.getDistance(p)[1];
          if(distanceCC<distance){
            distance = distanceCC;
View Full Code Here


    PointEntree p2 = new PointEntree(5, 1.25);
   
    PointEntree p3 = new PointEntree(-5, -1.25);
    PointSortie p4 = new PointSortie(5, -1.25);
   
    CourbeConduite cc1 = new CourbeConduite(this, p2, p1);
    CourbeConduite cc2 = new CourbeConduite(this, p3, p4);
   
    this.addCourbeConduite(cc1);
    this.addCourbeConduite(cc2);
   
    this.addEntree(p2);
View Full Code Here

    //Reconstitution des CC
    int nCC = dis.readShort();
    for(int i=0; i<nCC; i++){
      int indexEntree = dis.readShort();
      int indexSortie = dis.readShort();
      CourbeConduite cc = new CourbeConduite(this, entrees.get(indexEntree), sorties.get(indexSortie));
      cc.load(dis);
      this.addCourbeConduite(cc);
    }
   
    //Reconstitution de la frontiere
    //TODO passer le code dans Polygone
View Full Code Here

    PointSortie p4 = new PointSortie(2*ecartement, -ecartement/2);
   
    PointSortie p5 = new PointSortie(-ecartement/2, -2*ecartement);
    PointEntree p6 = new PointEntree(ecartement/2, -2*ecartement);
   
    CourbeConduite cc1 = new CourbeConduite(this, p2, p1);
    cc1.addSegment();
    CourbeConduite cc2 = new CourbeConduite(this, p3, p4);
    cc2.addSegment();
   
    CourbeConduite cc3 = new CourbeConduite(this, p3, p5, Direction.DROITE);
    cc3.addPointIntermediaire(new Point(-ecartement, -ecartement/2));
    cc3.addPointIntermediaire(new Point(-ecartement + ecartement/2/Math.sqrt(2), -ecartement + ecartement/2/Math.sqrt(2)));
    cc3.addPointIntermediaire(new Point(-ecartement/2, -ecartement));
    cc3.addSegment();
    cc3.addArc(new Point(-ecartement, -ecartement), ecartement/2, 0, Math.PI/2, 1);
    cc3.addSegment();
   
    CourbeConduite cc4 = new CourbeConduite(this, p6, p1, Direction.GAUCHE);
    cc4.addPointIntermediaire(new Point(ecartement/2, -ecartement/2));
    cc4.addPointIntermediaire(new Point(-ecartement/2 + ecartement/Math.sqrt(2), -ecartement/2 + ecartement/Math.sqrt(2)));
    cc4.addPointIntermediaire(new Point(-ecartement/2, ecartement/2));
    cc4.addSegment();
    cc4.addArc(new Point(-ecartement/2, -ecartement/2), ecartement, Math.PI/2, -Math.PI/2, 1);
    cc4.addSegment();
   
    CourbeConduite cc5 = new CourbeConduite(this, p2, p5, Direction.GAUCHE);
    cc5.addPointIntermediaire(new Point(ecartement/2, ecartement/2));
    cc5.addPointIntermediaire(new Point(ecartement/2 - ecartement/Math.sqrt(2), -ecartement/2 + ecartement/Math.sqrt(2)));
    cc5.addPointIntermediaire(new Point(-ecartement/2, -ecartement/2));
    cc5.addSegment();
    cc5.addArc(new Point(ecartement/2, -ecartement/2), ecartement, 0, -Math.PI/2, 1);
    cc5.addSegment();
   
    CourbeConduite cc6 = new CourbeConduite(this, p6, p4, Direction.DROITE);
    cc6.addPointIntermediaire(new Point(ecartement/2, -ecartement));
    cc6.addPointIntermediaire(new Point(ecartement - ecartement/2/Math.sqrt(2), -ecartement + ecartement/2/Math.sqrt(2)));
    cc6.addPointIntermediaire(new Point(ecartement, -ecartement/2));
    cc6.addSegment();
    cc6.addArc(new Point(ecartement, -ecartement), ecartement/2, -Math.PI/2, Math.PI/2, 1);
    cc6.addSegment();
   
    this.addCourbeConduite(cc1);
    this.addCourbeConduite(cc2);
    this.addCourbeConduite(cc3);
    this.addCourbeConduite(cc4);
View Full Code Here

    PointSortie p8 = new PointSortie(ecartMoy, -3*ecartementPrincipal/2);
   
    PointSortie p9 = new PointSortie(-ecartementSecondaire/2, -2*ecartementPrincipal);
    PointEntree p10 = new PointEntree(ecartementSecondaire/2, -2*ecartementPrincipal);
   
    CourbeConduite cc1 = new CourbeConduite(carrefour, p2, p1);
    cc1.addSegment();
    CourbeConduite cc2 = new CourbeConduite(carrefour, p4, p3);
    cc2.addSegment();
    CourbeConduite cc3 = new CourbeConduite(carrefour, p5, p6);
    cc3.addSegment();
    CourbeConduite cc4 = new CourbeConduite(carrefour, p7, p8);
    cc4.addSegment();
   
    CourbeConduite cc5 = new CourbeConduite(carrefour, p10, p8);
    cc5.addArc(new Point(ecartMoy, -2*ecartementPrincipal), ecartementPrincipal/2, -Math.PI/2, Math.PI/2, 0);
    CourbeConduite cc6 = new CourbeConduite(carrefour, p10, p6);
    cc6.addPointIntermediaire(new Point(ecartementSecondaire/2, -ecartementPrincipal));
    cc6.addSegment();
    cc6.addArc(new Point(ecartMoy, -ecartementPrincipal), ecartementPrincipal/2, -Math.PI/2, Math.PI/2, 0);
    CourbeConduite cc7 = new CourbeConduite(carrefour, p10, p1);
    cc7.addSegment();
    CourbeConduite cc8 = new CourbeConduite(carrefour, p10, p3);
    cc8.addSegment();
   
    CourbeConduite cc9 = new CourbeConduite(carrefour, p2, p9);
    cc9.addSegment();
    CourbeConduite cc10 = new CourbeConduite(carrefour, p4, p9);
    cc10.addSegment();
    CourbeConduite cc11 = new CourbeConduite(carrefour, p5, p9);
    cc11.addSegment();
    CourbeConduite cc12 = new CourbeConduite(carrefour, p7, p9);
    cc12.addArc(new Point(-ecartMoy, -2*ecartementPrincipal), ecartementPrincipal/2, 0, Math.PI/2, 0);
   
    carrefour.addCourbeConduite(cc1);
    carrefour.addCourbeConduite(cc2);
    carrefour.addCourbeConduite(cc3);
    carrefour.addCourbeConduite(cc4);
View Full Code Here

    PointEntree p2 = new PointEntree((rayon + ecartement/2)*Math.sin(ouverture), (rayon + ecartement/2)*Math.cos(ouverture));
   
    PointEntree p3 = new PointEntree(0, rayon -ecartement/2);
    PointSortie p4 = new PointSortie((rayon - ecartement/2)*Math.sin(ouverture), (rayon - ecartement/2)*Math.cos(ouverture));
   
    CourbeConduite cc1 = new CourbeConduite(this, p2, p1);
    CourbeConduite cc2 = new CourbeConduite(this, p3, p4);
   
    this.addCourbeConduite(cc1);
    this.addCourbeConduite(cc2);
   
    int iterations = (int)(ouverture/FINESSE);
    List<Point> sommets = new ArrayList<Point>();
   
    sommets.add(Point.createPolarNorth(rayon + ecartement, ouverture));
    for (int i=iterations-1; i>0; i--){
      Point pi1 = Point.createPolarNorth(rayon + ecartement/2, i*ouverture/iterations);
      cc1.addPointIntermediaire(pi1);
      Point pf = Point.createPolarNorth(rayon + ecartement, i*ouverture/iterations);
      sommets.add(pf);
    }
    cc1.addArc(new Point(), rayon + ecartement/2, ouverture, -ouverture, iterations-1);
    sommets.add(Point.createPolarNorth(rayon + ecartement, 0));
    sommets.add(Point.createPolarNorth(rayon - ecartement, 0));
    for (int i=1; i<iterations; i++){
      Point pi2 = Point.createPolarNorth(rayon - ecartement/2, i*ouverture/iterations);
      cc2.addPointIntermediaire(pi2);
      Point pf = Point.createPolarNorth(rayon - ecartement, i*ouverture/iterations);
      sommets.add(pf);
    }
    cc2.addArc(new Point(), rayon - ecartement/2, 0, ouverture, iterations-1);
    sommets.add(Point.createPolarNorth(rayon - ecartement, ouverture));
   
    this.addEntree(p2);
    this.addEntree(p3);
    this.addSortie(p1);
View Full Code Here

     
      for(int i=0; i<nbVoies; i++){
        PointSortie ps = new PointSortie(longueur/2, i*ecartement - (nbVoies-1)*(ecartement/2));
        PointEntree pe = new PointEntree(-longueur/2, i*ecartement - (nbVoies-1)*(ecartement/2));
       
        CourbeConduite cc = new CourbeConduite(route, pe, ps);
        cc.addSegment();
       
        route.addCourbeConduite(cc);
        route.addEntree(pe);
        route.addSortie(ps);
      }
     
      route.creerFrontiere(longueur, ecartement*nbVoies/2);
    } else {
      route = new RouteDroite(position, angle, nom);
     
      for(int i=0; i<nbVoies; i++){
        PointSortie p1 = new PointSortie(-longueur/2, ecartement/2 + i*ecartement);
        PointEntree p2 = new PointEntree(longueur/2, ecartement/2 + i*ecartement);
       
        PointEntree p3 = new PointEntree(-longueur/2, -ecartement/2 - i*ecartement);
        PointSortie p4 = new PointSortie(longueur/2, -ecartement/2 - i*ecartement);
       
        CourbeConduite cc1 = new CourbeConduite(route, p2, p1);
        cc1.addSegment();
        CourbeConduite cc2 = new CourbeConduite(route, p3, p4);
        cc2.addSegment();
       
        route.addCourbeConduite(cc1);
        route.addCourbeConduite(cc2);
       
        route.addEntree(p2);
View Full Code Here

TOP

Related Classes of ds.moteur.route.cc.CourbeConduite

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.