original_string: public function reduce( $degree, $lookAhead=null )
      {
          if ($lookAhead) {
              $this->lookAhead = (int)$lookAhead;
          }
          $epsilon = deg2rad($degree);
          $results = array();
          for ($i = 0; $i < $this->count(); $i++) {
              $j = min($i + $this->lookAhead, $this->lastKey());
              $basePoint = $this->points[$i];
              $results[] = $basePoint;
              $boundPoint = $this->points[$j];
              $theta = $this->_theta($basePoint, $boundPoint);
              $a1 = $theta - $epsilon;
              $a2 = $theta + $epsilon;
  
              while (++$i < $j) {
                  $testPoint = $this->points[$i];
                  $delta = $this->_theta($basePoint, $testPoint);
                  if ($a1 < $delta && $delta < $a2) {
                      // Ommit this point
                  } else {
                      // This point is outside of the sleeve.
                      // Make this point the new base point.
                      break;
                  }
              }
              $i--; // Backup iterator
          }
          return $this->points = $results;
      }
code: public function reduce( $degree, $lookAhead=null )
      {
          if ($lookAhead) {
              $this->lookAhead = (int)$lookAhead;
          }
          $epsilon = deg2rad($degree);
          $results = array();
          for ($i = 0; $i < $this->count(); $i++) {
              $j = min($i + $this->lookAhead, $this->lastKey());
              $basePoint = $this->points[$i];
              $results[] = $basePoint;
              $boundPoint = $this->points[$j];
              $theta = $this->_theta($basePoint, $boundPoint);
              $a1 = $theta - $epsilon;
              $a2 = $theta + $epsilon;
  
              while (++$i < $j) {
                  $testPoint = $this->points[$i];
                  $delta = $this->_theta($basePoint, $testPoint);
                  if ($a1 < $delta && $delta < $a2) {
                      // Ommit this point
                  } else {
                      // This point is outside of the sleeve.
                      // Make this point the new base point.
                      break;
                  }
              }
              $i--; // Backup iterator
          }
          return $this->points = $results;
      }
code_tokens: public function reduce ( $ degree , $ lookAhead = null ) { if ( $ lookAhead ) { $ this -> lookAhead = ( int ) $ lookAhead ; } $ epsilon = deg2rad ( $ degree ) ; $ results = array ( ) ; for ( $ i = 0 ; $ i < $ this -> count ( ) ; $ i ++ ) { $ j = min ( $ i + $ this -> lookAhead , $ this -> lastKey ( ) ) ; $ basePoint = $ this -> points [ $ i ] ; $ results [ ] = $ basePoint ; $ boundPoint = $ this -> points [ $ j ] ; $ theta = $ this -> _theta ( $ basePoint , $ boundPoint ) ; $ a1 = $ theta - $ epsilon ; $ a2 = $ theta + $ epsilon ; while ( ++ $ i < $ j ) { $ testPoint = $ this -> points [ $ i ] ; $ delta = $ this -> _theta ( $ basePoint , $ testPoint ) ; if ( $ a1 < $ delta && $ delta < $ a2 ) { // Ommit this point } else { // This point is outside of the sleeve. // Make this point the new base point. break ; } } $ i -- ; // Backup iterator } return $ this -> points = $ results ; }
docstring: Reduce points with modified version of Zhao-Saalfeld simplification.
  
  @param double  $degree    Angle between 0 & 360 to compare points.
  @param integer $lookAhead Number of points to include in each sector
  bound iteration.
  
  @return array Reduced set of points
docstring_tokens: Reduce points with modified version of Zhao - Saalfeld simplification .