getHeight method Null safety

double getHeight(
  1. List<Point<num>> triangle
)

Get the height of a triangle

height is the distance from a vertex to the baseline

Implementation

static double getHeight(List<Point> triangle) {
  assert(triangle.length == 3);
  final baseLine = getBaseLine(triangle);
  final posVertex =
      triangle.firstWhere((p) => p != baseLine.p1 && p != baseLine.p2);
  final distance = LineUtils.pointToLineDistance(posVertex, baseLine);
  return distance;
}