Object TFloatRectangle
Unit
CastleRectangles
Declaration
type TFloatRectangle = object(TObject)
Description
2D rectangle with float coordinates. Useful for various 2D GUI operations, and for bounding boxes for 2D objects.
The area covered by the rectangle starts at (Left,Bottom) position and spans (Width,Height) units. The rectangle is empty (Contains will always answer False) when either Width or Height are less than zero. This is consistent with it's 3D equivalent, TBox3D, and different from it's integer counterpart TRectangle. In case of float bounding box (TBox3D) or float rectangle (TFloatRectangle), having a zero size makes sense, and it still is something non-empty (a single 2D or 3D point has zero size, but also has position).
Hierarchy
Overview
Fields
Methods
Properties
 |
property Right: Single read GetRight; |
 |
property Top: Single read GetTop; |
Description
Fields
 |
Left: Single; |
|
|
 |
Bottom: Single; |
|
|
 |
Width: Single; |
|
|
 |
Height: Single; |
|
|
Methods
 |
function IsEmpty: boolean; |
|
|
 |
function Contains(const X, Y: Single): boolean; |
|
|
 |
function Middle: TVector2Single; deprecated 'use Center'; |
|
Warning: this symbol is deprecated: use Center |
 |
function Grow(const Delta: Single): TFloatRectangle; |
|
Grow (when Delta > 0) or shrink (when Delta < 0) the rectangle, returning new value. This adds a margin of Delta pixels around all sides of the rectangle, so in total width grows by 2 * Delta, and the same for height. In case of shrinking, we protect from shrinking too much: the resulting width or height is set to zero (which makes a valid and empty rectangle) if shrinking too much.
|
 |
function ToString: string; |
|
|
 |
function Collides(const R: TFloatRectangle): boolean; |
|
Does it have any common part with another rectangle.
|
 |
function CollidesDisc(const DiscCenter: TVector2Single; const Radius: Single): boolean; |
|
|
 |
function ScaleAround0(const Factor: Single): TFloatRectangle; |
|
Scale rectangle position and size around the (0,0) point.
|
 |
function ToX3DVector: TVector4Single; |
|
Convert to a 4D vector, like expected by X3D fields OrthoViewpoint.fieldOfView or DirectionalLight.projectionRectangle.
|
 |
class function FromX3DVector(const V: TVector4Single): TFloatRectangle; static; |
|
Convert from a 4D vector, like expected by X3D fields OrthoViewpoint.fieldOfView or DirectionalLight.projectionRectangle.
|
Properties
 |
property Right: Single read GetRight; |
|
Right and Top pixels are 1 pixel *outside* of the rectangle.
|
 |
property Top: Single read GetTop; |
|
|
Generated by PasDoc 0.14.0.
|