../../Developer.FoundationDotJS.org/wwwroot/Library/Foundation.Geometry.jsFoundationObject
  All Implemented Interfaces:
Foundation.Rectangle
implementsFoundation.Class
Two dimensional rectangle class with x, y, width and height.
| Constructor Summary | 
| Creates a rectangle from x, y, width and height values. | 
| Creates a rectangle from another rectangle. | 
| Field Summary | |
|  | heightThe height of the rectangle. | 
|  | widthThe width of the rectangle. | 
|  | xThe x origin of the rectangle. | 
|  | yThe y origin of the rectangle. | 
| Method Summary | |
|  | Positively offsets the rectangle by a point. | 
|  | Positively offsets the by x and y values. | 
|  | Ceils the x, y, width and height values of the rectangle. | 
|  | Moves the rectangle as necessary to center it on a point. | 
|  | Creates a copy of the rectangle. | 
|  | Gets a point inside the rectangle that is closest to a target point. | 
|  | Gets a rectangle inside the rectangle that is closest to a target rectangle. | 
|  | Alters the rectangle as necessary to contain a point. | 
|  | Alters the rectangle as necessary to contain a polygon. | 
|  | Alters the rectangle as necessary to contain another rectangle. | 
|  | Checks to see if a point is inside the rectangle. | 
|  | Checks to see if an x y pair is inside the rectangle. | 
|   |  | 
|  | The distance to a point, or zero if the point is contained in the rectangle. | 
|  | Compares a rectangle with another rectangle. | 
|  | Compares a rectangle with x, y, width and height values. | 
|  | Floors the x, y, width and height values of the rectangle. | 
|  | Gets the center of the rectangle as a point. | 
|  | The size of the rectangle as a  Foundation.Point. | 
|  | Insets the rectangle by point values. | 
|  | Insets the rectangle by x and y values. | 
| static  | Parses a string representation of a rectangle into a new  Foundation.Rectangle. | 
|  | Resizes the rectangle to point values. | 
|  | Resizes the rectangle to width and height values. | 
|  | Resizes the rectangle by point values. | 
|  | Resizes the rectangle by width and height values. | 
|  | Rotates the rectangle by an angle. The rectangle returned is the actually the smallest rectagle that will contain the rotated rectagle. | 
|  | Rounds the x, y, width and height values of the rectangle. | 
|  | Scales the rectangle. Both the origin and size are scaled. | 
|  | Sets the rectangle equal to another rectangle. | 
|  | Sets the rectangle equal to x, y, width and height values. | 
|  | Negatively offsets the rectangle by another rectangle or by x,y,w,h values. | 
|  | Negatively offsets the rectangle by x and y values. | 
|  | A string representation of the rectangle. | 
|  | Transforms the rectangle by an transformation matrix. | 
| Methods inherited from Foundation.Class | 
| getTypePath,isInstanceOf | 
| Constructor Detail | 
Foundation.Rectangle(/*Number*/ x,
                     /*Number*/ y,
                     /*Number*/ width,
                     /*Number*/ height)
Creates a rectangle from x, y, width and height values.
Parameters:x -X value.
y -Y value.
width -Width value.
height -Height value.
Foundation.Rectangle(/*Rectangle*/ rectangle)
Creates a rectangle from another rectangle.
Parameters:rectangle -Rectangle to copy.
| Field Detail | 
Number height
The height of the rectangle.
Number width
The width of the rectangle.
Number x
The x origin of the rectangle.
Number y
The y origin of the rectangle.
| Method Detail | 
[this] add(/*Point*/ Point)
Positively offsets the rectangle by a point.
Parameters:Point -to add by.
[this] add(/*Number*/ x,
           /*Number*/ y)
Positively offsets the by x and y values.
Parameters:x -X value to add by.
y -Y value to add by.
[this] ceil()
Ceils the x, y, width and height values of the rectangle.
Returns:
[this] center(/*Point*/ point)
Moves the rectangle as necessary to center it on a point.
Parameters:point -Point on which to center.
Rectangle clone()
Creates a copy of the rectangle.
Returns:
Point constrainPoint(/*Point*/ point)
Gets a point inside the rectangle that is closest to a target point.
Parameters:point -The target point. This point is not altered.
Rectangle constrainRectangle(/*Rectangle*/ point)
Gets a rectangle inside the rectangle that is closest to a target rectangle.
Parameters:point -The target rectangle. This rectangle is not altered.
[this] containPoint(/*Point*/ point)
Alters the rectangle as necessary to contain a point.
Parameters:point -Point value to contain.
[this] containPolygon(/*Polygon*/ polygon)
Alters the rectangle as necessary to contain a polygon.
Parameters:polygon -Polygon value to contain.
[this] containRectangle(/*Rectangle*/ rectangle)
Alters the rectangle as necessary to contain another rectangle.
Parameters:rectangle -Rectangle value to contain.
Boolean containsPoint(/*Point*/ point)
Checks to see if a point is inside the rectangle.
Parameters:point -The point to check.
Boolean containsXY(/*Number*/ x,
                   /*Number*/ y)
Checks to see if an x y pair is inside the rectangle.
Parameters:x -The x value to check.
y -The y value to check.
dispose()
dispose in class Class
Number distanceToPoint(/*Point*/ point)
The distance to a point, or zero if the point is contained in the rectangle.
Parameters:point -The target point.
Boolean equals(/*Rectangle*/ rectangle)
Compares a rectangle with another rectangle.
Parameters:rectangle -Other rectangle to compare to.
Boolean equals(/*Number*/ x,
               /*Number*/ y,
               /*Number*/ width,
               /*Number*/ hheight)
Compares a rectangle with x, y, width and height values.
Parameters:x -X value to compare to.
y -Y value to compare to.
width -Width value to compare to.
hheight -Height value to compare to.
[this] floor()
Floors the x, y, width and height values of the rectangle.
Returns:
Point getCenter()
Gets the center of the rectangle as a point.
Returns:
Point getSize()
The size of the rectangle as a Foundation.Point.
[this] inset(/*Point*/ point)
Insets the rectangle by point values.
Parameters:point -Point value to inset by.
[this] inset(/*Number*/ x,
             /*Number*/ y)
Insets the rectangle by x and y values.
Parameters:x -X value to inset by.
y -Y value to inset by.
static Rectangle parse(/*String*/ rectangleString)
Parses a string representation of a rectangle into a new Foundation.Rectangle.
rectangleString -The string representation of the rectangle.
[this] resize(/*Point*/ point)
Resizes the rectangle to point values.
Parameters:point -Point values to resize to.
[this] resize(/*Number*/ width,
              /*Number*/ height)
Resizes the rectangle to width and height values.
Parameters:width -Width value to resize to.
height -Height value to resize to.
[this] resizeBy(/*Point*/ point)
Resizes the rectangle by point values.
Parameters:point -Point values to resize by.
[this] resizeBy(/*Number*/ width,
                /*Number*/ height)
Resizes the rectangle by width and height values.
Parameters:width -Width value to resize by.
height -Height value to resize by.
[this] rotate(/*Number*/ radians)
Rotates the rectangle by an angle. The rectangle returned is the actually the smallest rectagle that will contain the rotated rectagle.
Parameters:radians -The angle (in radians) to rotate the rectangle by.
[this] round()
Rounds the x, y, width and height values of the rectangle.
Returns:
[this] scale(/*Number*/ scale)
Scales the rectangle. Both the origin and size are scaled.
Parameters:scale -The number to scale by.
[this] set(/*Rectangle*/ rectangle)
Sets the rectangle equal to another rectangle.
Parameters:rectangle -Other rectangle to set by.
[this] set(/*Number*/ x,
           /*Number*/ y,
           /*Number*/ width,
           /*Number*/ height)
Sets the rectangle equal to x, y, width and height values.
Parameters:x -X value to set by.
y -Y value to set by.
width -Width value to set by.
height -Height value to set by.
[this] subtract(/*Rectangle*/ rectangle)
Negatively offsets the rectangle by another rectangle or by x,y,w,h values.
Parameters:rectangle -Other rectangle subtract by.
[this] subtract(/*Number*/ x,
                /*Number*/ y)
Negatively offsets the rectangle by x and y values.
Parameters:x -X value to subtract by.
y -Y value to subtract by.
String toString()
A string representation of the rectangle.
Overrides:toString in class Class
[this] transform(/*TMatrix*/ tMatrix)
Transforms the rectangle by an transformation matrix.
Parameters:tMatrix -The transformation matrix.