SPRectangle Class Reference
Inherits from | SPPoolObject : NSObject |
Conforms to | NSCopying |
Declared in | SPRectangle.h |
Overview
The SPRectangle class describes a rectangle by its top-left corner point (x, y) and by its width and height.
Tasks
Initializers
-
– initWithX:y:width:height:
Initializes a rectangle with the specified components. Designated Initializer.
-
+ rectangleWithX:y:width:height:
Factory method.
Methods
-
– containsX:y:
Determines if a point is within the rectangle.
-
– containsPoint:
Determines if a point is within the rectangle.
-
– containsRectangle:
Determines if another rectangle is within the rectangle.
-
– intersectsRectangle:
Determines if another rectangle contains or intersects the rectangle.
-
– intersectionWithRectangle:
If the specified rectangle intersects with the rectangle, returns the area of intersection.
-
– uniteWithRectangle:
Adds two rectangles together to create a new Rectangle object (by filling in the space between the two rectangles).
-
– setEmpty
Sets width and height components to zero.
-
– isEquivalent:
Compares two points.
Properties
-
x
The x coordinate of the rectangle.
property -
y
The y coordinate of the rectangle.
property -
width
The width of the rectangle.
property -
height
The height of the rectangle.
property -
top
The y coordinate of the rectangle.
property -
bottom
The sum of the y and height properties.
property -
left
The x coordinate of the rectangle.
property -
right
The sum of the x and width properties.
property -
topLeft
The location of the top-left corner, determined by the x and y coordinates of the point.
property -
bottomRight
The location of the bottom-right corner, determined by the values of the right and bottom properties.
property -
size
The size of the Rectangle object, determined by the values of the width and height properties.
property -
isEmpty
Determines if a rectangle has an empty area.
property
Properties
bottom
The sum of the y and height properties.
@property (nonatomic, assign) float bottom
Discussion
The sum of the y and height properties.
Declared In
SPRectangle.h
bottomRight
The location of the bottom-right corner, determined by the values of the right and bottom properties.
@property (nonatomic, copy) SPPoint *bottomRight
Discussion
The location of the bottom-right corner, determined by the values of the right and bottom properties.
Declared In
SPRectangle.h
height
The height of the rectangle.
@property (nonatomic, assign) float height
Discussion
The height of the rectangle.
Declared In
SPRectangle.h
isEmpty
Determines if a rectangle has an empty area.
@property (nonatomic, readonly) BOOL isEmpty
Discussion
Determines if a rectangle has an empty area.
Declared In
SPRectangle.h
left
The x coordinate of the rectangle.
@property (nonatomic, assign) float left
Discussion
The x coordinate of the rectangle.
Declared In
SPRectangle.h
right
The sum of the x and width properties.
@property (nonatomic, assign) float right
Discussion
The sum of the x and width properties.
Declared In
SPRectangle.h
size
The size of the Rectangle object, determined by the values of the width and height properties.
@property (nonatomic, copy) SPPoint *size
Discussion
The size of the Rectangle object, determined by the values of the width and height properties.
Declared In
SPRectangle.h
top
The y coordinate of the rectangle.
@property (nonatomic, assign) float top
Discussion
The y coordinate of the rectangle.
Declared In
SPRectangle.h
topLeft
The location of the top-left corner, determined by the x and y coordinates of the point.
@property (nonatomic, copy) SPPoint *topLeft
Discussion
The location of the top-left corner, determined by the x and y coordinates of the point.
Declared In
SPRectangle.h
width
The width of the rectangle.
@property (nonatomic, assign) float width
Discussion
The width of the rectangle.
Declared In
SPRectangle.h
Instance Methods
containsPoint:
Determines if a point is within the rectangle.
- (BOOL)containsPoint:(SPPoint *)point
Discussion
Determines if a point is within the rectangle.
Declared In
SPRectangle.h
containsRectangle:
Determines if another rectangle is within the rectangle.
- (BOOL)containsRectangle:(SPRectangle *)rectangle
Discussion
Determines if another rectangle is within the rectangle.
Declared In
SPRectangle.h
containsX:y:
Determines if a point is within the rectangle.
- (BOOL)containsX:(float)x y:(float)y
Discussion
Determines if a point is within the rectangle.
Declared In
SPRectangle.h
initWithX:y:width:height:
Initializes a rectangle with the specified components. Designated Initializer.
- (id)initWithX:(float)x y:(float)y width:(float)width height:(float)height
Discussion
Initializes a rectangle with the specified components. Designated Initializer.
Declared In
SPRectangle.h
intersectionWithRectangle:
If the specified rectangle intersects with the rectangle, returns the area of intersection.
- (SPRectangle *)intersectionWithRectangle:(SPRectangle *)rectangle
Discussion
If the specified rectangle intersects with the rectangle, returns the area of intersection.
Declared In
SPRectangle.h
intersectsRectangle:
Determines if another rectangle contains or intersects the rectangle.
- (BOOL)intersectsRectangle:(SPRectangle *)rectangle
Discussion
Determines if another rectangle contains or intersects the rectangle.
Declared In
SPRectangle.h
isEquivalent:
Compares two points.
- (BOOL)isEquivalent:(SPRectangle *)other
Discussion
Compares two points.
Declared In
SPRectangle.h
setEmpty
Sets width and height components to zero.
- (void)setEmpty
Discussion
Sets width and height components to zero.
Declared In
SPRectangle.h
uniteWithRectangle:
Adds two rectangles together to create a new Rectangle object (by filling in the space between the two rectangles).
- (SPRectangle *)uniteWithRectangle:(SPRectangle *)rectangle
Discussion
Adds two rectangles together to create a new Rectangle object (by filling in the space between the two rectangles).
Declared In
SPRectangle.h