/** * Calculate vertical ratio array * @return array [%o] */ public function calculate() { if (!$this->Trackdata->has(Trackdata\Entity::VERTICAL_OSCILLATION) || !$this->Trackdata->has(Trackdata\Entity::STRIDE_LENGTH)) { return []; } $Oscillation = $this->Trackdata->verticalOscillation(); $StrideLength = $this->Trackdata->strideLength(); $Size = $this->Trackdata->num(); $this->VerticalRatio = array(); for ($i = 0; $i < $Size; ++$i) { $this->VerticalRatio[] = $StrideLength[$i] > 0 ? round(100 * $Oscillation[$i] / $StrideLength[$i]) : 0; } return $this->VerticalRatio; }