SetaPDF_Core_Geometry_Rectangle Class representing a rectangle

File: /SetaPDF/Core/Geometry/Rectangle.php

Class hierarchy

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()

public SetaPDF_Core_Geometry_Rectangle::__construct ( int|float|SetaPDF_Core_Geometry_Point $a, int|float|SetaPDF_Core_Geometry_Point $b [, int|float $c = null [, int|float $d = null ]] )

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()

private boolean SetaPDF_Core_Geometry_Rectangle::_pointInside ( int|float $x, int|float $y [, boolean $ignoreEqual = false ] )

Checks whether a point is inside or on the border of this rectangle.

Parameters
$x : int|float
 
$y : int|float
 
$ignoreEqual : boolean

If the point lays on the border and this is true false will returned

contains()

public boolean SetaPDF_Core_Geometry_Rectangle::contains ( SetaPDF_Core_Geometry_Point|SetaPDF_Core_Geometry_Rectangle $geometry )

Checks whether this rectangle contains another geometric object.

Parameters
$geometry : SetaPDF_Core_Geometry_Point|SetaPDF_Core_Geometry_Rectangle
 
Exceptions

Throws InvalidArgumentException

getDimensions()

public array SetaPDF_Core_Geometry_Rectangle::getDimensions ( void )

Returns the width and height of the rectangle.

getHeight()

public float SetaPDF_Core_Geometry_Rectangle::getHeight ( void )

Returns the actual height of the rectangle.

getLl()

public SetaPDF_Core_Geometry_Point SetaPDF_Core_Geometry_Rectangle::getLl ( void )

Returns the lower left point of the rectangle.

Note: changing the returned point object don't changing the rectangle.

getLr()

public SetaPDF_Core_Geometry_Point SetaPDF_Core_Geometry_Rectangle::getLr ( void )

Returns the lower right point of the rectangle.

Note: changing the returned point object don't changing the rectangle.

getUl()

public SetaPDF_Core_Geometry_Point SetaPDF_Core_Geometry_Rectangle::getUl ( void )

Returns the upper left point of the rectangle.

Note: changing the returned point object don't changing the rectangle.

getUr()

public SetaPDF_Core_Geometry_Point SetaPDF_Core_Geometry_Rectangle::getUr ( void )

Returns the upper right point of the rectangle.

Note: changing the returned point object don't changing the rectangle.

getWidth()

public float SetaPDF_Core_Geometry_Rectangle::getWidth ( void )

Returns the actual width of the rectangle.

init()

public void SetaPDF_Core_Geometry_Rectangle::init ( int|float $x1, int|float $y1, int|float $x2, int|float $y2 )

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()

public boolean SetaPDF_Core_Geometry_Rectangle::intersect ( SetaPDF_Core_Geometry_Rectangle $geometry )

Checks whether the geometry shape intersect this rectangle.

Parameters
$geometry : SetaPDF_Core_Geometry_Rectangle
 
Exceptions

Throws InvalidArgumentException

scale()

public SetaPDF_Core_Geometry_Rectangle SetaPDF_Core_Geometry_Rectangle::scale ( float $by )

Scale the rectangle by a value into all directions.

Parameters
$by : float
 

scaleX()

public SetaPDF_Core_Geometry_Rectangle SetaPDF_Core_Geometry_Rectangle::scaleX ( float $by )

Scales the rectangle by a value on the x directon.

Parameters
$by : float
 

scaleY()

public SetaPDF_Core_Geometry_Rectangle SetaPDF_Core_Geometry_Rectangle::scaleY ( float $by )

Scales the rectangle by a value on the y directon.

Parameters
$by : float
 

setDimensions()

public void SetaPDF_Core_Geometry_Rectangle::setDimensions ( int|float $width, int|float $height )

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()

public void SetaPDF_Core_Geometry_Rectangle::setHeight ( int|float $height )

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()

public void SetaPDF_Core_Geometry_Rectangle::setLl ( int|float|SetaPDF_Core_Geometry_Point $a [, int|float $b = null ] )

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()

public void SetaPDF_Core_Geometry_Rectangle::setLr ( int|float|SetaPDF_Core_Geometry_Point $a [, int|float $b = null ] )

Set the lower right point of the rectangle.

Parameters
$a : int|float|SetaPDF_Core_Geometry_Point
 
$b : int|float
 
See

setUl()

public void SetaPDF_Core_Geometry_Rectangle::setUl ( int|float|SetaPDF_Core_Geometry_Point $a [, int|float $b = null ] )

Set the upper left point of the rectangle.

Parameters
$a : int|float|SetaPDF_Core_Geometry_Point
 
$b : int|float
 
See

setUr()

public void SetaPDF_Core_Geometry_Rectangle::setUr ( int|float|SetaPDF_Core_Geometry_Point $a [, int|float $b = null ] )

Set the upper right point of the rectangle.

Parameters
$a : int|float|SetaPDF_Core_Geometry_Point
 
$b : int|float
 
See

setWidth()

public void SetaPDF_Core_Geometry_Rectangle::setWidth ( int|float $width )

Set the width of the rectangle.

The lower left point couldn't be moved by this method.

Parameters
$width : int|float
 
Exceptions

Throws InvalidArgumentException