Package trafficjams.model.util

Examples of trafficjams.model.util.Point


    public Point getCoord() {
        float p = element.getAbsolutePositionValue(value);
        float d = p / (element.getLength() - p);
        float x = (element.getFCross().getCoord().getX() + d * element.getLCross().getCoord().getX()) / (1+d) ;
        float y = (element.getFCross().getCoord().getY() + d * element.getLCross().getCoord().getY()) / (1+d) ;
        return new Point(x,y);
    }
View Full Code Here


        for (int i = 0 ; i<crossCount; ++i){
            if (i==0){
                for (int j = 0 ; j < crossCount; ++j){
                    CrossRoad currCross = new CrossRoad(retVal);
                    l_crossRoads.add(currCross);
                    currCross.setCoord(new Point(gorLength*i + gorLength*rand(), vertLength*j + vertLength * rand()));
                    a_crossRoads[i][j] = currCross;
                    if (j==0){
                        continue;
                    }
                    r = new Road(retVal);
                    roads.add(r);
                    r.setFCross(a_crossRoads[i][j-1]);
                    r.setLCross(currCross);

                    ((CrossRoad)a_crossRoads[i][j-1]).setRoadForDirection(r, right);
                    currCross.setRoadForDirection(r, left);

                }
                continue;
            }

            for (int j = 0 ; j < crossCount; ++j){
                CrossRoad currCross = new CrossRoad(retVal);
                l_crossRoads.add(currCross);
                currCross.setCoord(new Point(gorLength*i + gorLength*rand(), vertLength*j + vertLength * rand()));
                a_crossRoads[i][j] = currCross;
                r = new Road(retVal);
                roads.add(r);
                r.setFCross(a_crossRoads[i-1][j]);
                r.setLCross(currCross);
View Full Code Here

    }

    private void removeNegatives(ArrayList<ICrossRoad> l_crossRoads) {
        for (ICrossRoad _cr : l_crossRoads){
            CrossRoad cr = (CrossRoad) _cr;
            Point p = cr.getCoord();
            float d = 0 ;
            if (p.getX()<0){
               // p.setX(Math.abs(p.getX()));
                p.setX(0);
            }
            if (p.getY()<0){
                //p.setY(Math.abs(p.getY()));
                p.setY(0);
            }
            if (p.getX()>Numbers.mapWidth){
                //p.setX(2*Numbers.mapWidth - p.getX());
                p.setX(0);
            }
            if (p.getY()>Numbers.mapWidth){
               //p.setY((2*Numbers.mapHeight-p.getY()));
               p.setY(0);
            }
            cr.setCoord(p);
        }
    }
View Full Code Here

TOP

Related Classes of trafficjams.model.util.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.