getTriangularHeight static method
传入直角三角形3个顶点,然后计算斜边为底的高度h
Implementation
static double getTriangularHeight(
Offset rightAnglePoint, Offset other, Offset other2) {
//先计算3边长度
//斜边
final hypotenuse = distanceTo(other, other2);
//另外两条边
final section = distanceTo(other, rightAnglePoint);
final section2 = distanceTo(other2, rightAnglePoint);
final h = section * section2 / hypotenuse;
return h;
}