SetaPDF_Core_Geometry_Rectangle Class representing a rectangle
File: /SetaPDF v2/Core/Geometry/Rectangle.php
Class hierarchy
Implements
Summary
Properties
$_llX
ll => lower left ur => upper right
$_llY
ll => lower left ur => upper right
$_urX
ll => lower left ur => upper right
$_urY
ll => lower left ur => upper right
Methods
__construct()
The constructor.
There three ways to create a rectangle:
- 2 params SetaPDF_Core_Geometry_Point $a point1 SetaPDF_Core_Geometry_Point $b point2 - 3 params SetaPDF_Core_Geometry_Point $a pointLL int|float $b width int|float $c height - 4 params int|float $a x of point1 int|float $b y of point1 int|float $c x of point2 int|float $d y of point2
Parameters
- $a : int|float|SetaPDF_Core_Geometry_Point
point1 OR pointLL OR x of point1
- $b : int|float|SetaPDF_Core_Geometry_Point
point2 OR width OR y of point1
- $c : int|float
height OR x of point2
- $d : int|float
none OR y of point2
Exceptions
Throws InvalidArgumentException
_pointInside()
Checks whether a point is inside or on the border of this rectangle.
Parameters
- $x : int|float
- $y : int|float
- $ignoreEqual : bool
If the point lays on the border and this is true false will be returned
collides()
Checks if this geometry collides with another geometry.
Parameters
- $geometry : SetaPDF_Core_Geometry_Collidable
contains()
Checks whether this rectangle contains another geometric object.
Parameters
Exceptions
Throws InvalidArgumentException
getLl()
Returns the lower left point of the rectangle.
Note: changing the returned point object don't changing the rectangle.
getLr()
Returns the lower right point of the rectangle.
Note: changing the returned point object don't changing the rectangle.
getUl()
Returns the upper left point of the rectangle.
Note: changing the returned point object don't changing the rectangle.
getUr()
Returns the upper right point of the rectangle.
Note: changing the returned point object don't changing the rectangle.
init()
Reset the complete rectangle by using two opposite points of the new rectangle.
Parameters
- $x1 : int|float
- $y1 : int|float
- $x2 : int|float
- $y2 : int|float
Exceptions
Throws InvalidArgumentException
intersect()
Checks whether the geometry shape intersect this rectangle.
Parameters
- $geometry : SetaPDF_Core_Geometry_Rectangle
Exceptions
Throws InvalidArgumentException
setDimensions()
Set the width and the height of the rectangle.
The lower left point couldn't be moved by this method.
Parameters
- $width : int|float
- $height : int|float
Exceptions
Throws InvalidArgumentException
setHeight()
Set the height of the rectangle.
The lower left point couldn't be moved by this method.
Parameters
- $height : int|float
Exceptions
Throws InvalidArgumentException
setLl()
Set the lower left point of the rectangle.
If you don't move this point over the x of the lower right or the y of the upper left this point stay the lower left.
If you move this point over only one of them, this point will replace them and the other point will be lower left.
If you move this point over both(x and y), this point will be the new upper right and upper right the new lower left.
Parameters
- $a : int|float|SetaPDF_Core_Geometry_Point
- $b : int|float
setLr()
Set the lower right point of the rectangle.
Parameters
- $a : int|float|SetaPDF_Core_Geometry_Point
- $b : int|float
See
setUl()
Set the upper left point of the rectangle.
Parameters
- $a : int|float|SetaPDF_Core_Geometry_Point
- $b : int|float
See
setUr()
Set the upper right point of the rectangle.
Parameters
- $a : int|float|SetaPDF_Core_Geometry_Point
- $b : int|float
See
setWidth()
Set the width of the rectangle.
The lower left point couldn't be moved by this method.
Parameters
- $width : int|float
Exceptions
Throws InvalidArgumentException