lib/sphere/from-raster.js
function _fieldGeometry() {

  const ifi = this._parent._interfieldIndices,
        ifc = this._parent._interfieldCentroids,
        i   = this._i;

  var max_φ    = -Infinity,
      min_φ    = Infinity,
      max_λ    = -Infinity,
      min_λ    = Infinity,
      mid_λ    = this._parent._positions[2 * i + 1],
      vertices = [];

  for (let v = 0; v < this._adjacentFields.length; v += 1) {

    let φ = ifc[2 * ifi[6 * i + v] + 0],
        λ = ifc[2 * ifi[6 * i + v] + 1];

    max_φ = max(max_φ, φ);
    min_φ = min(min_φ, φ);

    max_λ = max(max_λ, λ);
    min_λ = min(min_λ, λ);

    vertices.push([λ, φ]);

  }

  if (i === 0) {
    max_φ = π / 2;
  }

  if (i === 1) {
    min_φ = π / -2;
  }

  if (i < 2) {
    min_λ = -π;
    max_λ = π;
    vertices = [
      [min_λ, max_φ],
      [max_λ, max_φ],
      [max_λ, min_φ],
      [min_λ, min_φ]
    ];
  } else if (max_λ > 0 && min_λ < 0 && (mid_λ < π / -2 || mid_λ > π / 2)) {
    // this spans the meridian, so shift negative λ values past π and recalculate latitudinal bounds

    max_λ = -Infinity;
    min_λ = Infinity;

    for (let v = 0; v < vertices.length; v += 1) {

      if (vertices[v][0] < 0) vertices[v][0] += τ;

      max_λ = max(max_λ, vertices[v][0]);
      min_λ = min(min_λ, vertices[v][0]);

    }

  }

  return {
    min_φ,
    max_φ,
    min_λ,
    max_λ,
    vertices
  };

}
function _fieldGeometry() {

  const ifi = this._parent._interfieldIndices,
        ifc = this._parent._interfieldCentroids,
        i   = this._i;

  var max_φ    = -Infinity,
      min_φ    = Infinity,
      max_λ    = -Infinity,
      min_λ    = Infinity,
      mid_λ    = this._parent._positions[2 * i + 1],
      vertices = [];

  for (let v = 0; v < this._adjacentFields.length; v += 1) {

    let φ = ifc[2 * ifi[6 * i + v] + 0],
        λ = ifc[2 * ifi[6 * i + v] + 1];

    max_φ = max(max_φ, φ);
    min_φ = min(min_φ, φ);

    max_λ = max(max_λ, λ);
    min_λ = min(min_λ, λ);

    vertices.push([λ, φ]);

  }

  if (i === 0) {
    max_φ = π / 2;
  }

  if (i === 1) {
    min_φ = π / -2;
  }

  if (i < 2) {
    min_λ = -π;
    max_λ = π;
    vertices = [
      [min_λ, max_φ],
      [max_λ, max_φ],
      [max_λ, min_φ],
      [min_λ, min_φ]
    ];
  } else if (max_λ > 0 && min_λ < 0 && (mid_λ < π / -2 || mid_λ > π / 2)) {
    // this spans the meridian, so shift negative λ values past π and recalculate latitudinal bounds

    max_λ = -Infinity;
    min_λ = Infinity;

    for (let v = 0; v < vertices.length; v += 1) {

      if (vertices[v][0] < 0) vertices[v][0] += τ;

      max_λ = max(max_λ, vertices[v][0]);
      min_λ = min(min_λ, vertices[v][0]);

    }

  }

  return {
    min_φ,
    max_φ,
    min_λ,
    max_λ,
    vertices
  };

}
Returns a field's edge vertices and its bounds. Latitudinal coordinates may be
greater than π if the field straddles the meridian across from 0.

@this Field
@returns {{min_φ: Number, max_φ: number, min_λ: Number, max_λ: number, vertices: Array}}
@private