package com.ard.data.noflyzone.domain;
|
|
public class Vertex {
|
public double x;
|
public double y;
|
|
public Vertex() {
|
|
}
|
|
public Vertex(double x, double y) {
|
this.x = x;
|
this.y = y;
|
}
|
|
// 判断这个点是不是和另外一个点重合(允许极小的误差,算作同一个点
|
public boolean IsSame(Vertex anotherV) {
|
double almostZero = 0.00000001;
|
if ((Math.abs(x - anotherV.x) < almostZero) && (Math.abs(y - anotherV.y) < almostZero)) {
|
return true;
|
} else {
|
return false;
|
}
|
}
|
|
// 直线距离
|
public double Distance(Vertex anotherV) {
|
return Math.sqrt(Math.pow(x - anotherV.x, 2) + Math.pow(y - anotherV.y, 2));
|
}
|
}
|