# Function G2lib::isCounterClockwise

- Defined in File G2lib.cc

## Function Documentation

int_type G2lib::isCounterClockwise(real_type const *P1, real_type const *P2, real_type const *P3)

  Return the orientation of a triangle

  return +1 = CounterClockwise return -1 = Clockwise return 0 = flat

  CounterClockwise: the path P1->P2->P3 turns Counter-Clockwise, i.e., the point P3 is located “on the left” of the line P1-P2. Clockwise: the path turns Clockwise, i.e., the point P3 lies “on the right” of the line P1-P2. flat: the point P3 is located on the line segment [P1 P2].

  Algorithm from FileExchage geom2d adapated from Sedgewick’s book.

  Parameters

    - P1 – [in] first point of the triangle

    - P2 – [in] second point of the triangle

    - P3 – [in] third point of the triangle

  Returns

    sign of rotation