code: function(obj) {
                  var P = this.pointClosestTo(obj);
                  return (P === null) ? null : P.distanceFrom(obj);
                }
docs: Returns the distance between the argument and the line segment's closest point to the argument