src/Math/Point.php
protected function toPolar($name)
  {
    if(!isset($this->gps['vl'], $this->gps['ap'], $this->gps['av']))
    {
      if(!isset($this->gps['x'], $this->gps['y'], $this->gps['z']))
        throw new \LogicException('Somehow, you managed to initialize instance with partial data.');

      $this->gps['vl'] = $this->distance();
      $this->gps['ap'] = atan2($this->gps['y'], $this->gps['x']);
      $this->gps['av'] = asin($this->gps['z'] / $this->gps['vl']);
    }

    return $this->gps[$name];
  }
protected function toPolar($name)
  {
    if(!isset($this->gps['vl'], $this->gps['ap'], $this->gps['av']))
    {
      if(!isset($this->gps['x'], $this->gps['y'], $this->gps['z']))
        throw new \LogicException('Somehow, you managed to initialize instance with partial data.');

      $this->gps['vl'] = $this->distance();
      $this->gps['ap'] = atan2($this->gps['y'], $this->gps['x']);
      $this->gps['av'] = asin($this->gps['z'] / $this->gps['vl']);
    }

    return $this->gps[$name];
  }
protected function toPolar ( $ name ) { if ( ! isset ( $ this -> gps [ 'vl' ] , $ this -> gps [ 'ap' ] , $ this -> gps [ 'av' ] ) ) { if ( ! isset ( $ this -> gps [ 'x' ] , $ this -> gps [ 'y' ] , $ this -> gps [ 'z' ] ) ) throw new \ LogicException ( 'Somehow, you managed to initialize instance with partial data.' ) ; $ this -> gps [ 'vl' ] = $ this -> distance ( ) ; $ this -> gps [ 'ap' ] = atan2 ( $ this -> gps [ 'y' ] , $ this -> gps [ 'x' ] ) ; $ this -> gps [ 'av' ] = asin ( $ this -> gps [ 'z' ] / $ this -> gps [ 'vl' ] ) ; } return $ this -> gps [ $ name ] ; }
Helper function to fill in missing properties, if needed.

@param $name the name of the requested property.
@return float the property value.
Helper function to fill in missing properties if needed .