Module: Geom2D::Algorithms
- Extended by:
- Utils
- Defined in:
- lib/geom2d/algorithms.rb,
lib/geom2d/algorithms/polygon_operation.rb
Overview
This module contains helper functions as well as classes implementing algorithms.
Defined Under Namespace
Classes: PolygonOperation
Class Method Summary collapse
-
.ccw(a, b, c) ⇒ Object
Determines whether the three points form a counterclockwise turn.
Class Method Details
.ccw(a, b, c) ⇒ Object
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.
29 30 31 |
# File 'lib/geom2d/algorithms.rb', line 29 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 |