You are here

protected function PositionedRectangle::determineBoundingCorners in Image Effects 8

Same name and namespace in other branches
  1. 8.3 src/Component/PositionedRectangle.php \Drupal\image_effects\Component\PositionedRectangle::determineBoundingCorners()
  2. 8.2 src/Component/PositionedRectangle.php \Drupal\image_effects\Component\PositionedRectangle::determineBoundingCorners()

Calculates the corners of the bounding rectangle.

The bottom left ('o_a') and top right ('o_c') corners of the bounding rectangle of a rotated rectangle are needed to determine the bounding width and height, and to calculate rotation-induced offest.

Return value

$this

1 call to PositionedRectangle::determineBoundingCorners()
PositionedRectangle::rotate in src/Component/PositionedRectangle.php
Rotates the rectangle and any additional point.

File

src/Component/PositionedRectangle.php, line 402

Class

PositionedRectangle
Rectangle algebra class.

Namespace

Drupal\image_effects\Component

Code

protected function determineBoundingCorners() {
  $this
    ->setPoint('o_a', [
    min($this->points['c_a'][0], $this->points['c_b'][0], $this->points['c_c'][0], $this->points['c_d'][0]),
    min($this->points['c_a'][1], $this->points['c_b'][1], $this->points['c_c'][1], $this->points['c_d'][1]),
  ])
    ->setPoint('o_c', [
    max($this->points['c_a'][0], $this->points['c_b'][0], $this->points['c_c'][0], $this->points['c_d'][0]),
    max($this->points['c_a'][1], $this->points['c_b'][1], $this->points['c_c'][1], $this->points['c_d'][1]),
  ]);
  return $this;
}