static <U extends Pair<Long, Double>> Area<U> ofTriangle(
      Pair<Long, Double> a, U b, Pair<Long, Double> c) {
    // area of a triangle = |[Ax(By - Cy) + Bx(Cy - Ay) + Cx(Ay - By)] / 2|
    List<Double> addends =
        Arrays.asList(
            a.getLeft() * (b.getRight() - c.getRight()),
            b.getLeft() * (c.getRight() - a.getRight()),
            c.getLeft() * (a.getRight() - b.getRight()));
    double sum = addends.stream().reduce(0d, Double::sum);
    double value = abs(sum / 2);
    return new Area<>(b, value);
  }
this class is copied and modified from <a
href="https://github.com/ggalmazor/lt_downsampling_java8">...</a> project
library-udf/src/main/java/org/apache/iotdb/library/dprofile/util/Area.java