code: function distance(ap, bp) {
    var dx, dy, dz;
  
    dx = ap.x - bp.x;
    dy = ap.y - bp.y;
    dz = ap.z - bp.z;
  
    return Math.sqrt(dx * dx + dy * dy + dz * dz);
  }
docs: Calculates distance between two points in 3d space
  
  @param {Object} ap
  @param {Object} bp
  @returns {Number}