Module: Geometry

Extended by:
Math
Includes:
Math
Defined in:
lib/geometry.rb,
lib/geometry/line.rb,
lib/geometry/point.rb,
lib/geometry/vector.rb,
lib/geometry/polygon.rb,
lib/geometry/segment.rb,
lib/geometry/bounding_box.rb,
lib/geometry/algorithms/point_in_polygon.rb

Defined Under Namespace

Classes: BoundingBox, Line, Point, PointInPolygon, Polygon, Segment, SegmentsDoNotIntersect, SegmentsOverlap, Vector

Class Method Summary collapse

Class Method Details

.distance(point1, point2) ⇒ Object


16
17
18
# File 'lib/geometry.rb', line 16

def distance(point1, point2)
  hypot point1.x - point2.x, point1.y - point2.y
end