function Rectangle::delta

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::delta()
  2. 10 core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::delta()
  3. 11.x core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::delta()

Returns the difference of a fraction from the closest between 0 and 1.

Parameters

float $input: The input value.

Return value

float the difference of a fraction from the closest between 0 and 1.

1 call to Rectangle::delta()
Rectangle::fixImprecision in core/lib/Drupal/Component/Utility/Rectangle.php
Performs an imprecision check on the input value and fixes it if needed.

File

core/lib/Drupal/Component/Utility/Rectangle.php, line 170

Class

Rectangle
Rectangle rotation algebra class.

Namespace

Drupal\Component\Utility

Code

protected function delta($input) {
    $fraction = $this->fraction($input);
    return $fraction > 0.5 ? 1 - $fraction : $fraction;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.