module Geom2D::Algorithms

This module contains helper functions as well as classes implementing algorithms.

Public Class Methods

ccw(a, b, c) click to toggle source

Determines whether the three points form a counterclockwise turn.

Returns

  • +1 if the points a -> b -> c form a counterclockwise angle,

  • -1 if the points a -> b -> c from a clockwise angle, and

  • 0 if the points are collinear.

# File lib/geom2d/algorithms.rb, line 28
def self.ccw(a, b, c)
  float_compare((b.x - a.x) * (c.y - a.y), (c.x - a.x) * (b.y - a.y))
end