g.js — graphical objects for JavaScript

distancedistance

Calculate the distance between two points.

g.distance({x: 0, y: 0}, {x: 100, y: 0});

The value returned is the Euclidean distance, or the “normal” distance as measured by a ruler.

Parameters

  • point1: The first point.
  • point2: The second point.