Rectangle2
extension Rectangle2: CustomStringConvertible
public extension Rectangle2 where Vector: VectorAdditive
public extension Rectangle2 where Vector: VectorReal
public extension Rectangle2 where Vector: VectorAdditive & VectorComparable
public extension Rectangle2 where Vector: VectorMultiplicative
public extension Rectangle2 where Scalar: FloatingPoint
extension Rectangle2: Convex2Type where Vector: Vector2FloatingPoint
-
Declaration
Swift
public var description: String { get }
-
The x coordinate of the right corner of this rectangle.
Alias for
x + width
.Declaration
Swift
var right: Scalar { get }
-
The y coordinate of the bottom corner of this rectangle.
Alias for
y + height
.Declaration
Swift
var bottom: Scalar { get }
-
The top-right corner of the rectangle.
Declaration
Swift
var topRight: Vector { get }
-
The bottom-left corner of the rectangle.
Declaration
Swift
var bottomLeft: Vector { get }
-
The bottom-right corner of the rectangle.
Declaration
Swift
var bottomRight: Vector { get }
-
Returns an array of vectors that represent this
Rectangle
‘s corners in clockwise order, starting from the top-left corner.Always contains 4 elements.
Declaration
Swift
@inlinable var corners: [Vector] { get }
-
Initializes a
Rectangle
with the edges of a box.Declaration
Swift
init(left: Scalar, top: Scalar, right: Scalar, bottom: Scalar)
-
Returns a new Rectangle with the same top, bottom, and width as the current instance, where the
right
lays onvalue
.Declaration
Swift
@inlinable func movingRight(to value: Scalar) -> NRectangle<Vector>
-
Returns a new Rectangle with the same left, right, and height as the current instance, where the
bottom
lays onvalue
.Declaration
Swift
@inlinable func movingBottom(to value: Scalar) -> NRectangle<Vector>
-
Returns a new Rectangle with the same top, bottom, and right as the current instance, where the
left
lays onvalue
.Declaration
Swift
@inlinable func stretchingLeft(to value: Scalar) -> NRectangle<Vector>
-
Returns a new Rectangle with the same left, right, and bottom as the current instance, where the
top
lays onvalue
.Declaration
Swift
@inlinable func stretchingTop(to value: Scalar) -> NRectangle<Vector>
-
Returns a new Rectangle with the same top, bottom, and left as the current instance, where the
right
lays onvalue
.Declaration
Swift
@inlinable func stretchingRight(to value: Scalar) -> NRectangle<Vector>
-
Returns a new Rectangle with the same left, right, and top as the current instance, where the
bottom
lays onvalue
.Declaration
Swift
@inlinable func stretchingBottom(to value: Scalar) -> NRectangle<Vector>
-
Insets this Rectangle with a given set of edge inset values.
Declaration
Swift
@inlinable func inset(_ inset: EdgeInsets2<Vector>) -> NRectangle<Vector>
-
Applies the given Matrix on all corners of this Rectangle, returning a new minimal Rectangle capable of containing the transformed points.
Declaration
Swift
func transformedBounds(_ matrix: Matrix3x2<Scalar>) -> NRectangle<Vector>
-
Returns whether a given point is contained within this bounding box.
The check is inclusive, so the edges of the bounding box are considered to contain the point as well.
Declaration
Swift
func contains(x: Scalar, y: Scalar) -> Bool
-
Returns a Rectangle with the same position as this Rectangle, with its width and height multiplied by the coordinates of the given vector.
Declaration
Swift
func scaledBy(x: Scalar, y: Scalar) -> NRectangle<Vector>
-
Initializes a Rectangle with the coordinates of a rectangle.
Declaration
Swift
init<B>(x: B, y: B, width: B, height: B) where B : BinaryInteger