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
Rectanglegeometrically equivalent to this one, with positiveheightandwidth.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
trueif theheightorwidthproperties ofsizeare0. 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
Rectanglewith the givenx,y,width, andheightvalues.Declaration
Swift
public init(x: Double, y: Double, width: Double, height: Double) -
Creates a
Rectanglewith the givenwidthandheight, with an origin ofPoint().Declaration
Swift
public init(width: Double, height: Double) -
Creates a
Rectanglewith the givenpolygon.Declaration
Swift
public init(_ polygon: Polygon) throws
-
Declaration
Swift
public func contains(_ point: Point) -> BoolReturn Value
trueif the givenpointis contained herein. Otherwise,false. -
Declaration
Swift
public func translatedBy(x: Double = 0, y: Double = 0) -> RectangleReturn Value
Rectangletranslated by the givenxandyvalues. -
Declaration
Swift
public func translated(by point: Point) -> RectangleReturn Value
Rectangletranslated by the givenpoint. -
Declaration
Swift
public func scaled(by value: Double, around anchor: ScaleAnchor) -> RectangleReturn Value
Rectanglewith dimensions scaled by the givenvaluearound the givenanchor. -
Declaration
Swift
public func scaledBy( width widthScale: Double = 1, height heightScale: Double = 1, around anchor: ScaleAnchor ) -> RectangleReturn Value
Rectanglewith dimensions scaled by the givenwidthandheight, around the givenanchor. -
Declaration
Swift
public static func + (lhs: Rectangle, rhs: Rectangle) -> Rectangle
-
Declaration
Swift
public var description: String { get }
View on GitHub
Install in Dash
Rectangle Structure Reference