当前位置: 首页>>代码示例>>Java>>正文


Java Point2D.getY方法代码示例

本文整理汇总了Java中rescuecore2.misc.geometry.Point2D.getY方法的典型用法代码示例。如果您正苦于以下问题:Java Point2D.getY方法的具体用法?Java Point2D.getY怎么用?Java Point2D.getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rescuecore2.misc.geometry.Point2D的用法示例。


在下文中一共展示了Point2D.getY方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: intersect

import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
private boolean intersect(double agentX, double agentY, double pointX, double pointY, Blockade blockade)
{
    List<Line2D> lines = GeometryTools2D.pointsToLines(GeometryTools2D.vertexArrayToPoints(blockade.getApexes()), true);
    for (Line2D line : lines)
    {
        Point2D start = line.getOrigin();
        Point2D end = line.getEndPoint();
        double startX = start.getX();
        double startY = start.getY();
        double endX = end.getX();
        double endY = end.getY();
        if (java.awt.geom.Line2D.linesIntersect(
                agentX, agentY, pointX, pointY,
                startX, startY, endX, endY
        ))
        {
            return true;
        }
    }
    return false;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:22,代码来源:ActionExtClear.java

示例2: linesIntersect

import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
public boolean linesIntersect(Point2D point, Point2D targetPoint, Edge edge) {
    Point2D start = edge.getStart();
    double startX = start.getX();
    double startY = start.getY();
    Point2D end = edge.getEnd();
    double endX = end.getX();
    double endY = end.getY();
    return Line2D.linesIntersect(point.getX(), point.getY(), targetPoint.getX(), targetPoint.getY(), startX, startY, endX, endY) && !PositionUtil.equalsPoint(targetPoint, ((startX + endX) / 2.0D), (startY + endX) / 2.0D, 10.0D);
}
 
开发者ID:AIT-Rescue,项目名称:AIT-Rescue,代码行数:10,代码来源:SampleTacticsPolice.java

示例3: linesIntersect

import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
public boolean linesIntersect(Point2D point, Point2D targetPoint, Edge edge) {
    Point2D start = edge.getStart();
    double startX = start.getX();
    double startY = start.getY();
    Point2D end = edge.getEnd();
    double endX = end.getX();
    double endY = end.getY();
    return Line2D.linesIntersect(point.getX(), point.getY(), targetPoint.getX(), targetPoint.getY(), startX, startY, endX, endY) &&
            !PositionUtil.equalsPoint(targetPoint, ((startX + endX) / 2.0D), (startY + endY) / 2.0D, 1000.0D);
}
 
开发者ID:AIT-Rescue,项目名称:AIT-Rescue,代码行数:11,代码来源:ClearPlanner.java

示例4: getEdgePoint

import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
private Point2D getEdgePoint(Edge edge) {
    Point2D start = edge.getStart();
    Point2D end = edge.getEnd();
    return new Point2D(((start.getX() + end.getX()) / 2.0D), ((start.getY() + end.getY()) / 2.0D));
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:6,代码来源:SampleKMeans.java

示例5: getIntersectEdgeAction

import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
private Action getIntersectEdgeAction(double agentX, double agentY, double pointX, double pointY, Road road)
{
    Set<Point2D> movePoints = this.getMovePoints(road);
    Point2D bestPoint = null;
    double bastDistance = Double.MAX_VALUE;
    for (Point2D p : movePoints)
    {
        if (!this.intersect(agentX, agentY, p.getX(), p.getY(), road))
        {
            if (!this.intersect(pointX, pointY, p.getX(), p.getY(), road))
            {
                double distance = this.getDistance(pointX, pointY, p.getX(), p.getY());
                if (distance < bastDistance)
                {
                    bestPoint = p;
                    bastDistance = distance;
                }
            }
        }
    }
    if (bestPoint != null)
    {
        double pX = bestPoint.getX();
        double pY = bestPoint.getY();
        if (!road.isBlockadesDefined())
        {
            return new ActionMove(Lists.newArrayList(road.getID()), (int) pX, (int) pY);
        }
        ActionClear actionClear = null;
        ActionMove actionMove = null;
        Vector2D vector = this.scaleClear(this.getVector(agentX, agentY, pX, pY));
        int clearX = (int) (agentX + vector.getX());
        int clearY = (int) (agentY + vector.getY());
        vector = this.scaleBackClear(vector);
        int startX = (int) (agentX + vector.getX());
        int startY = (int) (agentY + vector.getY());
        for (Blockade blockade : this.worldInfo.getBlockades(road))
        {
            if (this.intersect(startX, startY, pX, pY, blockade))
            {
                if (this.intersect(startX, startY, clearX, clearY, blockade))
                {
                    if (actionClear == null)
                    {
                        actionClear = new ActionClear(clearX, clearY, blockade);
                    }
                    else
                    {
                        if (actionClear.getTarget() != null)
                        {
                            Blockade another = (Blockade) this.worldInfo.getEntity(actionClear.getTarget());
                            if (another != null && this.intersect(blockade, another))
                            {
                                return new ActionClear(another);
                            }
                        }
                        return actionClear;
                    }
                }
                else if (actionMove == null)
                {
                    actionMove = new ActionMove(Lists.newArrayList(road.getID()), (int) pX, (int) pY);
                }
            }
        }
        if (actionClear != null)
        {
            return actionClear;
        }
        else if (actionMove != null)
        {
            return actionMove;
        }
    }
    Action action = this.getAreaClearAction((PoliceForce) this.agentInfo.me(), road);
    if (action == null)
    {
        action = new ActionMove(Lists.newArrayList(road.getID()), (int) pointX, (int) pointY);
    }
    return action;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:82,代码来源:ActionExtClear.java

示例6: getEdgePoint

import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
public static Point2D getEdgePoint(Edge edge) {
    Point2D start = edge.getStart();
    Point2D end = edge.getEnd();
    return new Point2D(((start.getX() + end.getX()) / 2.0D), ((start.getY() + end.getY()) / 2.0D));
}
 
开发者ID:AIT-Rescue,项目名称:AIT-Rescue,代码行数:6,代码来源:PositionUtil.java

示例7: valueOfCompare

import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
public static double valueOfCompare(Point2D position, Point2D another) {
    double dx = position.getX() - another.getX();
    double dy = position.getY() - another.getY();
    return dx*dx + dy*dy;
}
 
开发者ID:AIT-Rescue,项目名称:AIT-Rescue,代码行数:6,代码来源:PositionUtil.java

示例8: think

import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
@Override
public Action think(int currentTime, ChangeSet updateWorldData, MessageManager manager) {
    this.organizeUpdateInfo(currentTime, updateWorldData, manager);
    if (this.me.getBuriedness() > 0) {
        return this.buriednessAction(manager);
    }
    if(posInit) {
        this.posInit = false;
        this.agentPoint[0] = new Point2D(this.me.getX(), this.me.getY());
        this.agentPoint[1] = new Point2D(this.me.getX(), this.me.getY());
    }
    else {
        this.agentPoint[1] = this.agentPoint[0];
        this.agentPoint[0] = new Point2D(this.me.getX(), this.me.getY());
    }

    this.checkClearPath(currentTime);

    if(this.target == null || this.clearPath == null || this.clearPath.isEmpty()) {
        this.target = this.impassableSelector.getNewTarget(currentTime);
        if(this.target != null && this.target.getValue() == this.me.getPosition().getValue()) {
            this.impassableSelector.remove(this.target);
            this.target = this.impassableSelector.getNewTarget(currentTime);
        }
        if(this.target == null) {
            this.beforeMove = true;
            return new ActionMove(this, this.routeSearcher.noTargetMove(currentTime, this.me));
        }
        this.clearPath = this.routeSearcher.getPath(currentTime, this.me(), this.target);
        if(this.clearPath == null || this.clearPath.isEmpty()) {
            this.beforeMove = true;
            return new ActionMove(this, this.routeSearcher.noTargetMove(currentTime, this.me));
        }
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //before agent position == this agent position && this.beforeMove
    if(this.target.getValue() != this.me().getPosition().getValue() && this.clearPoints == null) {
        if (this.beforeMove) {
            //clear
            if (PositionUtil.equalsPoint(this.agentPoint[1], this.agentPoint[0], 1000.0D)) {
                this.beforeMove = false;
                EntityID id = this.clearPath.get(this.clearPath.indexOf(this.me.getPosition()) + 1);
                return this.clear.getAction(this, id);
            }
        }
        this.beforeMove = true;
        return new ActionMove(this, this.clearPath);
    }
    else {
        Point2D targetPoint = this.clearPoints.get(this.count);
        if (this.beforeMove) {
            //clear
            if (PositionUtil.equalsPoint(this.agentPoint[1], this.agentPoint[0], 1000.0D)) {
                this.beforeMove = false;
                return this.clear.getAction(this, targetPoint);
            }
        }
        List<EntityID> path = new ArrayList<>();
        if(this.target.getValue() != this.me().getPosition().getValue()) {
            path.add(this.me().getPosition());
        }
        path.add(this.target);
        return new ActionMove(this, path, (int)targetPoint.getX(), (int)targetPoint.getY());
    }
}
 
开发者ID:AIT-Rescue,项目名称:AIT-Rescue,代码行数:66,代码来源:NewTacticsPolice.java


注:本文中的rescuecore2.misc.geometry.Point2D.getY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。