Generate steps

@param float $latitude
@param float $longitude
@param int $steps
@param float $radius
@param bool $walkBack

@return array
487568
public static function generateSteps(float $latitude, float $longitude, int $steps, float $radius = 0.07, $walkBack = false)
    {
        $result = [[
            $latitude,
            $longitude,
            self::BEARING_NORTH
        ]];
        $pulse = $radius;
        $xDistance = sqrt(3) * $pulse;
        $yDistance = 3 * ($pulse / 2);
        $location = [$latitude, $longitude];

        for ($step = 1; $step < $steps; $step++) {
            $location = self::calculateNewCoordinates($location[0], $location[1], $yDistance, self::BEARING_NORTH);
            $location = self::calculateNewCoordinates($location[0], $location[1], $xDistance / 2, self::BEARING_WEST);

            for ($direction = 0; $direction < 6; $direction++) {
                for ($s = 0; $s < $step; $s++){
                    switch($direction) {
                        case 0:
                            $location = self::calculateNewCoordinates($location[0], $location[1], $xDistance, self::BEARING_EAST);
                            break;
                        case 1:
                            $location = self::calculateNewCoordinates($location[0], $location[1], $yDistance, self::BEARING_SOUTH);
                            $location = self::calculateNewCoordinates($location[0], $location[1], $xDistance / 2, self::BEARING_EAST);
                            break;
                        case 2:
                            $location = self::calculateNewCoordinates($location[0], $location[1], $yDistance, self::BEARING_SOUTH);
                            $location = self::calculateNewCoordinates($location[0], $location[1], $xDistance / 2, self::BEARING_WEST);
                            break;
                        case 3:
                            $location = self::calculateNewCoordinates($location[0], $location[1], $xDistance, self::BEARING_WEST);
                            break;
                        case 4:
                            $location = self::calculateNewCoordinates($location[0], $location[1], $yDistance, self::BEARING_NORTH);
                            $location = self::calculateNewCoordinates($location[0], $location[1], $xDistance / 2, self::BEARING_WEST);
                            break;
                        case 5:
                            $location = self::calculateNewCoordinates($location[0], $location[1], $yDistance, self::BEARING_NORTH);
                            $location = self::calculateNewCoordinates($location[0], $location[1], $xDistance / 2, self::BEARING_EAST);
                            break;
                    }

                    $result[] = [
                        $location[0],
                        $location[1],
                        self::BEARING_NORTH
                    ];
                }
            }
        }

        /* Walk back to center */
        if ($walkBack === true) {
            for ($step = 1; $step < ($steps - 1); $step++) {
                $location = self::calculateNewCoordinates($location[0], $location[1], $yDistance, self::BEARING_SOUTH);
                $location = self::calculateNewCoordinates($location[0], $location[1], $xDistance / 2, self::BEARING_EAST);
                $result[] = [
                    $location[0],
                    $location[1],
                    self::BEARING_NORTH
                ];
            }
        }

        return $result;
    }
1217617
public function writeLongitude(float $longitude): string
    {
        return $this->writeDegrees($longitude, self::LONGITUDE_EAST, self::LONGITUDE_WEST);
    }
1256451
public function forward($p)
    {
        $lon = $p->x;
        $lat = $p->y;

        $delta_lon = Common::adjust_lon( $lon - $this->long0 ); // Delta longitude
        //$con = 0;    // cone constant
        //$x = 0;
        //$y = 0;
        $sin_phi = sin( $lat );
        $cos_phi = cos( $lat );

        if (isset($this->sphere) && $this->sphere === true) {
            // spherical form
            $b = $cos_phi * sin($delta_lon);

            if ((abs(abs($b) - 1.0)) < .0000000001) {
                Proj4php::reportError( "tmerc:forward: Point projects into infinity" );
                return(93);
            } else {
                $x = .5 * $this->a * $this->k0 * log( (1.0 + $b) / (1.0 - $b) );
                $con = acos( $cos_phi * cos( $delta_lon ) / sqrt( 1.0 - $b * $b ) );

                if ($lat < 0) {
                    $con = - $con;
                }

                $y = $this->a * $this->k0 * ($con - $this->lat0);
            }
        } else {
            $al = $cos_phi * $delta_lon;
            $als = pow( $al, 2 );
            $c = $this->ep2 * pow( $cos_phi, 2 );
            $tq = tan( $lat );
            $t = pow( $tq, 2 );
            $con = 1.0 - $this->es * pow( $sin_phi, 2 );
            $n = $this->a / sqrt( $con );

            $ml = $this->a * Common::mlfn( $this->e0, $this->e1, $this->e2, $this->e3, $lat );

            $x = $this->k0 * $n * $al * (1.0 + $als / 6.0 * (1.0 - $t + $c + $als / 20.0 * (5.0 - 18.0 * $t + pow( $t, 2 ) + 72.0 * $c - 58.0 * $this->ep2))) + $this->x0;
            $y = $this->k0 * ($ml - $this->ml0 + $n * $tq * ($als * (0.5 + $als / 24.0 * (5.0 - $t + 9.0 * $c + 4.0 * pow( $c, 2 ) + $als / 30.0 * (61.0 - 58.0 * $t + pow( $t, 2 ) + 600.0 * $c - 330.0 * $this->ep2))))) + $this->y0;
        }

        $p->x = $x;
        $p->y = $y;

        return $p;
    }
1031638
private List<Float> interpolateDownwards(float max, int steps) {

        List<Float> result = new ArrayList<Float>();
        if (max > 0) {
            // We try to generate a "nice" descending list of non-negative floats
            // where the step size is bigger for bigger "max" values.
            float base = (max > 1) ? (float)Math.floor(max) : max;
            float stepSize = 1000f;

            // reduce step size until the smallest element is greater than max/10.
            while ((base - (steps * stepSize)) < (max / 10.0f)) {
                stepSize = reduceStepSize(stepSize);
            }
            // we have determined the step size, now we generate the actual numbers
            for (int i = 0; i < steps; i++) {
                result.add(new Float(base - ((i + 1) * stepSize)));
            }
            Collections.reverse(result);
        } else {
            LOG.warn("Invalid navpos value: " + max);
            for (int i = 0; i < steps; i++) {
                result.add(new Float(max - (i + 1)));
            }
            Collections.reverse(result);
        }
        return result;
    }
651798
public function products($latitude, $longitude) {
        $path = '/v1/products';
        $parameters = array(
            'latitude' => $latitude,
            'longitude' => $longitude
        );
        $result = $this->adapter->get($path, $parameters, $this->getHeaders());
        return $this->format($result);
    }
584361
public function marker($latitude, $longitude, array $options = [])
	{
		$items = $this->getItems();

		if (empty($items)) {
			throw new MapperInstanceException('No map found to add a marker to.');
		}
        $item = end($items);
        $parameters = $this->getOptions();
		$options = array_replace_recursive(
			['markers' => $parameters['markers']],
			$item->getOptions()['markers'],
			$options
		);

		$item->marker($latitude, $longitude, $options);

		return $this;
	}
421509
protected function generateLocationAuth(string $authTicket, float $latitude, float $longitude, float $altitude = 0.0)
    {
        $seed = hexdec(xxhash32($authTicket, 0x1B845238));
        return (int)hexdec(xxhash32($this->getLocationBytes($latitude, $longitude, $altitude), (int)$seed));
    }
1364555
function previousStep( $step )
    {
        if ( is_string( $step ) ){
            foreach ( $this->StepTable as $key => $tableStep )
            {
                if ( $step == $tableStep['class'] )
                {
                    return $this->StepTable[--$key];
                }
            }
        }
        else
        {
            foreach ( $this->StepTable as $key => $tableStep )
            {
                if ( $step['class'] == $tableStep['class'] )
                {
                    return $this->StepTable[--$key];
                }
            }
        }
        $retValue = null;
        return $retValue;
    }
1176936
public function getPokestopDetails(string $id, float $latitude, float $longitude) : FortDetailsResponse
    {
        $request = new GetPokestopDetails($id, $latitude, $longitude);
        return $this->service->execute($request, $this->position);
    }
115484
public static function seconds(int $step = 1, int $start = 0, int $end = 60) : array
    {
        return Date::_range($step, $start, $end);
    }
946107
public function getGymDetails(string $id, float $latitude, float $longitude) : GetGymDetailsResponse
    {
        $request = new GetGymDetails($this->position, $id, $latitude, $longitude);
        return $this->service->execute($request, $this->position);
    }
1024948
protected function createExampleSteps()
    {
        $steps = array();
        foreach ($this->outlineSteps as $outlineStep) {
            $keyword = $outlineStep->getKeyword();
            $keywordType = $outlineStep->getKeywordType();
            $text = $this->replaceTextTokens($outlineStep->getText());
            $args = $this->replaceArgumentsTokens($outlineStep->getArguments());
            $line = $outlineStep->getLine();

            $steps[] = new StepNode($keyword, $text, $args, $line, $keywordType);
        }

        return $steps;
    }
851310
function commitStep( $package, $http, $step, &$persistentData, $tpl )
    {
        $methodMap = $this->commitStepMethodMap();
        if ( count( $methodMap ) > 0 )
        {
            if ( isset( $methodMap[$step['id']] ) )
            {
                $method = $methodMap[$step['id']];
                return $this->$method( $package, $http, $step, $persistentData, $tpl );
            }
        }
    }
962167
public function getMigrations($steps)
    {
        $query = $this->table()->where('batch', '>=', '1');

        return $query->orderBy('migration', 'desc')->take($steps)->get()->all();
    }
303916
public function forward($p)
    {
        $lon = $p->x;
        $lat = $p->y;

        $delta_lon = Common::adjust_lon($lon - $this->long0);
        $theta = $lat;
        $con = Common::PI * sin($lat);

        // Iterate using the Newton-Raphson method to find theta

        for ($i = 0; true; ++$i) {
            $delta_theta = -($theta + sin($theta) - $con) / (1.0 + cos($theta));
            $theta += $delta_theta;

            if (abs($delta_theta) < Common::EPSLN) {
                break;
            }

            if ($i >= 50) {
                Proj4php::reportError("moll:Fwd:IterationError");
                //return(241);
            }
        }

        $theta /= 2.0;

        // If the latitude is 90 deg, force the x coordinate to be "0 . false easting"
        // this is done here because of precision problems with "cos(theta)"

        if (Common::PI / 2 - abs($lat) < Common::EPSLN) {
            $delta_lon = 0;
        }

        $x = 0.900316316158 * $this->a * $delta_lon * cos($theta) + $this->x0;
        $y = 1.4142135623731 * $this->a * sin($theta) + $this->y0;

        $p->x = $x;
        $p->y = $y;

        return $p;
    }
976633
public function roundMinutes($step=15, $direction = null)
    {

        $function = "round";
        if ($direction && preg_match("/.*up.*/i", $direction)) {
            $function = "ceil";
        } else if ($direction && preg_match("/.*down.*/i", $direction)) {
            $function = "floor";
        }
        $stepSeconds    = $step * 60;
        $nowSeconds     = $this->getTimestamp();
        $roundedSeconds = $function($nowSeconds / ($stepSeconds)) * ($stepSeconds);
        $this->setTimestamp($roundedSeconds);
        return $this;
    }
230124
function generateArcPath (x, y, radius, startAngle, endAngle) {
  var start = polarToCartesian(x, y, radius, startAngle);
  var end = polarToCartesian(x, y, radius, endAngle);
  var arcSweep = endAngle - startAngle <= 180 ? '0' : '1';
  return [
    'M', start.x, start.y,
    'A', radius, radius, 0, arcSweep, 0, end.x, end.y
  ].join(' ');
}