Rectangle
public struct Rectangle : ConvexPolygonProtocol
extension Rectangle: AdditiveSemigroup
extension Rectangle: Equatable
extension Rectangle: CustomStringConvertible
A structure that contains the location and dimensions of a rectangle.
Todo
Consider storing vertices as withPolygon
, as opposed to being computed.
-
Undocumented
See moreDeclaration
Swift
public enum ScaleAnchor
-
A
Rectangle
geometrically equivalent to this one, with positiveheight
andwidth
.Declaration
Swift
public var normalized: Rectangle { get }
-
Vertices comprising
Rectangle
.Declaration
Swift
public var vertices: VertexCollection { get }
-
Minimum X value.
Declaration
Swift
public var minX: Double { get }
-
Horizontal midpoint.
Declaration
Swift
public var midX: Double { get }
-
Maximum X value.
Declaration
Swift
public var maxX: Double { get }
-
Minimum Y value.
Declaration
Swift
public var minY: Double { get }
-
Vertical midpoint.
Declaration
Swift
public var midY: Double { get }
-
Maximum Y value.
Declaration
Swift
public var maxY: Double { get }
-
Declaration
Swift
public var isEmpty: Bool { get }
Return Value
true
if theheight
orwidth
properties ofsize
are0
. Otherwise, false. -
Center point.
Declaration
Swift
public var center: Point { get }
-
Origin.
Declaration
Swift
public let origin: Point
-
Size.
Declaration
Swift
public let size: Size
-
Creates a
Rectangle
with the givenx
,y
,width
, andheight
values.Declaration
Swift
public init(x: Double, y: Double, width: Double, height: Double)
-
Creates a
Rectangle
with the givenwidth
andheight
, with an origin ofPoint()
.Declaration
Swift
public init(width: Double, height: Double)
-
Creates a
Rectangle
with the givenpolygon
.Declaration
Swift
public init(_ polygon: Polygon) throws
-
Declaration
Swift
public func contains(_ point: Point) -> Bool
Return Value
true
if the givenpoint
is contained herein. Otherwise,false
. -
Declaration
Swift
public func translatedBy(x: Double = 0, y: Double = 0) -> Rectangle
Return Value
Rectangle
translated by the givenx
andy
values. -
Declaration
Swift
public func translated(by point: Point) -> Rectangle
Return Value
Rectangle
translated by the givenpoint
. -
Declaration
Swift
public func scaled(by value: Double, around anchor: ScaleAnchor) -> Rectangle
Return Value
Rectangle
with dimensions scaled by the givenvalue
around the givenanchor
. -
Declaration
Swift
public func scaledBy( width widthScale: Double = 1, height heightScale: Double = 1, around anchor: ScaleAnchor ) -> Rectangle
Return Value
Rectangle
with dimensions scaled by the givenwidth
andheight
, around the givenanchor
. -
Declaration
Swift
public static func + (lhs: Rectangle, rhs: Rectangle) -> Rectangle
-
Declaration
Swift
public var description: String { get }