本文整理汇总了Java中rescuecore2.misc.geometry.Point2D.translate方法的典型用法代码示例。如果您正苦于以下问题:Java Point2D.translate方法的具体用法?Java Point2D.translate怎么用?Java Point2D.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rescuecore2.misc.geometry.Point2D
的用法示例。
在下文中一共展示了Point2D.translate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVector
import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
public Vector2D getVector(Point2D agentPos, Point2D targetPos, Road road) {
EntityID roadID = road.getID();
if (!this.clearListMap.containsKey(roadID)) {
this.analysisRoad(road);
}
List<Edge> edges = road.getEdges();
if (this.canStraightForward(agentPos, targetPos, roadID, edges)) {
return targetPos.minus(agentPos).normalised().scale(1000000);
} else {
Point2D edgePoint;
Point2D min = null;
for (Edge edge : edges) {
edgePoint = PositionUtil.getEdgePoint(edge);
if (this.canStraightForward(agentPos, edgePoint, roadID, edges)) {
min = min != null ? PositionUtil.compareDistance(agentPos, min, edgePoint).translate(0.0D, 0.0D) : edgePoint.translate(0.0D, 0.0D);
}
}
return min == null ? targetPos.minus(agentPos).normalised().scale(1000000) : min.minus(agentPos).normalised().scale(1000000);
}
}
示例2: getVector
import rescuecore2.misc.geometry.Point2D; //导入方法依赖的package包/类
public Vector2D getVector(Point2D agentPos, Area location, Point2D targetPos) {
EntityID areaID = location.getID();
List<Edge> edges = location.getEdges();
if (this.canStraightForward(agentPos, targetPos, areaID, edges)) {
return targetPos.minus(agentPos).normalised().scale(1000000);
} else {
Point2D edgePoint;
Point2D min = null;
for (Edge edge : edges) {
edgePoint = PositionUtil.getEdgePoint(edge);
if (this.canStraightForward(agentPos, edgePoint, areaID, edges)) {
min = min != null ? PositionUtil.compareDistance(agentPos, min, edgePoint).translate(0.0D, 0.0D) : edgePoint.translate(0.0D, 0.0D);
}
}
return min == null ? targetPos.minus(agentPos).normalised().scale(1000000) : min.minus(agentPos).normalised().scale(1000000);
}
}