package 平分的直线;
class Point {
int x;
int y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
public Point() {
this.x = 0;
this.y = 0;
}
}
public class Bipartition {
public double[] getBipartition(Point[] A, Point[] B) {
double firstX = (A[0].x + A[1].x) / 2.0;
double firstY = (A[0].y + A[3].y) / 2.0;
double secondX = (B[0].x + B[1].x) / 2.0;
double secondY = (B[0].y + B[3].y) / 2.0;
double slope = (secondY - firstY) / (secondX - firstX);
double y = secondY - slope * secondX;
double[] res = new double[2];
res[0] = slope;
res[1] = y;
return res;
}
public static void main(String[] args) {
}
}
平分正方形的直线
最新推荐文章于 2024-07-27 22:26:21 发布