平面幾何(距離)
リポジトリ
TODO:
- distanceLP
- distanceLL
- distanceLS
点間距離だけでなくいろいろあった方が便利なので作っとく
線分と点
のへの正射影を求めて、が上にあれば、
無ければ、
//instance method of Point class public final double distancePS(Line s){ Point proj = projection(s); return proj.intersectsPS(s) ? distance(proj) : Math.min(distance(s.start), distance(s.end)); } //instance method of Line class public final double distanceSP(Point p){ return p.distancePS(this); }