public static function S2pv($theta, $phi, $r, $td, $pd, $rd, array &$pv) {
    $st;
    $ct;
    $sp;
    $cp;
    $rcp;
    $x;
    $y;
    $rpd;
    $w;

    $st  = sin($theta);
    $ct  = cos($theta);
    $sp  = sin($phi);
    $cp  = cos($phi);
    $rcp = $r * $cp;
    $x   = $rcp * $ct;
    $y   = $rcp * $st;
    $rpd = $r * $pd;
    $w   = $rpd * $sp - $cp * $rd;

    $pv[0][0] = $x;
    $pv[0][1] = $y;
    $pv[0][2] = $r * $sp;
    $pv[1][0] = -$y * $td - $w * $ct;
    $pv[1][1] = $x * $td - $w * $st;
    $pv[1][2] = $rpd * $cp + $sp * $rd;

    return;
  }