area function

double area(
  1. Node? p,
  2. Node? q,
  3. Node? r
)

Implementation

double area(Node? p, Node? q, Node? r) {
  if(p == null && q == null && r == null) return 0;

  return ((q?.y ?? 0) - (p?.y ?? 0)) * ((r?.x ?? 0) - (q?.x ?? 0)) - ((q?.x ?? 0) - (p?.x ?? 0)) * ((r?.y ?? 0) - (q?.y ?? 0));
}