original_string: public function reduce( $target )
      {
          $kill = count($this) - $target;
          while ( $kill-- > 0 ) {
              $idx = 1;
              $minArea = $this->areaOfTriangle(
                  $this->points[0],
                  $this->points[1],
                  $this->points[2]
              );
              foreach (range(2, $this->lastKey(-2)) as $segment) {
                  $area = $this->areaOfTriangle(
                      $this->points[$segment - 1],
                      $this->points[$segment],
                      $this->points[$segment + 1]
                  );
                  if ( $area < $minArea ) {
                      $minArea = $area;
                      $idx = $segment;
                  }
              }
              array_splice($this->points, $idx, 1);
          }
          return $this->points;
      }
code: public function reduce( $target )
      {
          $kill = count($this) - $target;
          while ( $kill-- > 0 ) {
              $idx = 1;
              $minArea = $this->areaOfTriangle(
                  $this->points[0],
                  $this->points[1],
                  $this->points[2]
              );
              foreach (range(2, $this->lastKey(-2)) as $segment) {
                  $area = $this->areaOfTriangle(
                      $this->points[$segment - 1],
                      $this->points[$segment],
                      $this->points[$segment + 1]
                  );
                  if ( $area < $minArea ) {
                      $minArea = $area;
                      $idx = $segment;
                  }
              }
              array_splice($this->points, $idx, 1);
          }
          return $this->points;
      }
code_tokens: public function reduce ( $ target ) { $ kill = count ( $ this ) - $ target ; while ( $ kill -- > 0 ) { $ idx = 1 ; $ minArea = $ this -> areaOfTriangle ( $ this -> points [ 0 ] , $ this -> points [ 1 ] , $ this -> points [ 2 ] ) ; foreach ( range ( 2 , $ this -> lastKey ( - 2 ) ) as $ segment ) { $ area = $ this -> areaOfTriangle ( $ this -> points [ $ segment - 1 ] , $ this -> points [ $ segment ] , $ this -> points [ $ segment + 1 ] ) ; if ( $ area < $ minArea ) { $ minArea = $ area ; $ idx = $ segment ; } } array_splice ( $ this -> points , $ idx , 1 ) ; } return $ this -> points ; }
docstring: Reduce points with Visvalingam-Whyatt algorithm.
  
  @param integer $target Desired count of points
  
  @return array Reduced set of points
docstring_tokens: Reduce points with Visvalingam - Whyatt algorithm .