calculation.java
来自「JAVA+MO(for JAVA)开发的基于遗传算法的最短路径源代码」· Java 代码 · 共 31 行
JAVA
31 行
package Tools;
import com.esri.mo2.cs.geom.Point;
public class Calculation{
public double calDiatance(Point point1, Point point2) {
double distance;
double x1, x2, y1, y2;
x1 = point1.getX();
y1 = point1.getY();
x2 = point2.getX();
y2 = point2.getY();
distance = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
distance = Math.sqrt(distance);
return distance;
}
public double calElev(Point point1, Point point2) {
double distance;
double x1, x2, y1, y2;
x1 = point1.getX();
y1 = point1.getY();
x2 = point2.getX();
y2 = point2.getY();
distance = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
distance = Math.sqrt(distance);
return distance;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?