Rectangle
| Kind of class: | class |
|---|---|
| Inherits from: | none |
| Version: | 1.0 |
| Author: | Francis Bourre, Cédric Néhémie |
| Classpath: | com.bourre.structures.Rectangle |
| File last modified: | Wednesday, 31 October 2007, 07:35:30 |
Rectangle data structure.Rectangle structure manage many informations like :
- Center point
- Top left corner
- Top Right corner
- Bottom left corner
- Bottom Right corner
- Left border
- Right border
- Top border
- Bottom border
- and position
Summary
Constructor
Rectangle
function Rectangle (
w:Number,
h:Number,
x:Number,
y:Number)
Constructs a new
Rectangle instance.Parameters:
w:
width
h:
height
x:
x position
y:
position
Instance properties
height
height:Number
(read,write)
height of
Rectangle.width
width:Number
(read,write)
width of
Rectangle.x
x:Number
(read,write)
x coordinate of
Rectangle.y
y:Number
(read,write)
y coordinate of
Rectangle.Instance methods
equals
function equals (
r:Rectangle) : Boolean
Compare 2 rectangles each other.
Rectangles are equals when size and position are
equals.
Parameters:
r:
The
Rectangle object to compare with the current one.Returns:
true if Rectangles are equals, false otherwise.getBottom
function getBottom (
) : Number
Returns bottom border
Returns:
NumbergetBottomLeft
function getBottomLeft (
) : Point
Returns bottom left corner.
Returns:
Point instance with bottom left position
getBottomRight
function getBottomRight (
) : Point
Returns bottom right corner.
Returns:
Point instance with bottom right position
getCenter
function getCenter (
) : Point
Returns center point
Returns:
Point instance with center position
getLeft
function getLeft (
) : Number
Returns left border
Returns:
NumbergetRight
function getRight (
) : Number
Returns right border
Returns:
NumbergetTop
function getTop (
) : Number
Returns top border
Returns:
NumbergetTopLeft
function getTopLeft (
) : Point
Returns top left corner.
Returns:
Point instance with top left position
getTopRight
function getTopRight (
) : Point
Returns top right corner.
Returns:
Point instance with top right position
setBottom
function setBottom (
n:Number) : Void
Set the rectangle bottom border
Parameters:
n:
The new bottom border
setBottomLeft
function setBottomLeft (
p:Point) : Void
Set the bottom left corner.
Modifying a corner change the size of the rectangle,
use x and y properties to align a rectangle
to a position.
Returns:
Point instance with new bottom left position
setBottomRight
function setBottomRight (
p:Point) : Void
Set the bottom right corner.
Modifying a corner change the size of the rectangle,
use x and y properties to align a rectangle
to a position.
Returns:
Point instance with new bottom right position
setLeft
function setLeft (
n:Number) : Void
Set the rectangle left border
Parameters:
n:
The new left border
setRight
function setRight (
n:Number) : Void
Set the rectangle right border
Parameters:
n:
The new right border
setTop
function setTop (
n:Number) : Void
Set the rectangle top border
Parameters:
n:
The new top border
setTopLeft
function setTopLeft (
p:Point) : Void
Set the top left corner.
Modifying a corner change the size of the rectangle,
use x and y properties to align a rectangle
to a position.
Returns:
Point instance with new top left position
setTopRight
function setTopRight (
p:Point) : Void
Set the top right corner.
Modifying a corner change the size of the rectangle,
use x and y properties to align a rectangle
to a position.
Returns:
Point instance with new top right position
toString
function toString (
) : String
Returns the string representation of this instance.
Returns:
String representation of this instance