areCorrectPoints static method

bool areCorrectPoints(
  1. Coord first,
  2. Coord second,
  3. Coord center, [
  4. bool clockwise = true,
])

Set the values of first and second if the tangent is in correct direction, that is clockwise.

This is calculated by checking if the vector from first to second and the vector second to radius are in the clockwise direction.

We check the direction of both by doing the cross product of both vectors.

Implementation

static bool areCorrectPoints(Coord first, Coord second, Coord center,
    [bool clockwise = true]) {
  final line = second - first;
  final radius = center - second;
  return (line.cross(radius) < 0) == clockwise;
}