Rectangle

Kind of class:class
Inherits from:BaseShape < CoreObject
Version:08/02/07
Author:Aaron Clinger
Classpath:org.casalib.math.geom.Rectangle
File last modified:Monday, 01 December 2008, 13:34:40
Stores position and size of a rectangle (or square).

Summary


Constructor
  • Rectangle (x:Number, y:Number, width:Number, height:Number)
    • Creates new rectangle object.
Instance methods

Constructor

Rectangle

function Rectangle (
x:Number, y:Number, width:Number, height:Number)

Creates new rectangle object.
Parameters:
x :
The horizontal position of the rectangle.
y :
The vertical position of the rectangle.
width :
Width of the rectangle.
height:
[optional] Height of the rectangle. If undefined assumes height matches width (Creates square).

Instance methods

clone

function clone (

Returns:
  • A new rectangle object with the same values as this rectangle.

containsPoint

function containsPoint (
pointObject:Point) : Boolean

destroy

function destroy (
) : Void

Overrides:

equals

function equals (
rectangleObject:Rectangle) : Boolean

Determines whether the rectangle specified in the rectangleObject parameter is equal to this rectangle object.
Parameters:
rectangleObject:
A defined Rectangle object.

getArea

function getArea (
) : Number

Overrides:

getPerimeter

function getPerimeter (
) : Number

getX2

function getX2 (
) : Number

Returns:
  • The right X position of the rectangle.

getY2

function getY2 (
) : Number

Returns:
  • The bottom Y position of the rectangle.

setX2

function setX2 (
x:Number) : Void

Sets the right position of the rectangle.
Parameters:
x:
The right X position of the rectangle.

setY2

function setY2 (
y:Number) : Void

Sets the bottom position of the rectangle.
Parameters:
y:
The bottom Y position of the rectangle.