SizeBase
public struct SizeBase<VectorType> where VectorType : Addable
A 2-dimensional vector representing a size.
-
The number of components in a
SizeBaseinstance.Declaration
Swift
public static var numberOfComponents: Int { get } -
The values of this vector.
Declaration
Swift
public private(set) var components: [VectorType] -
The width of the
SizeBase(the first component of the vector).Declaration
Swift
public var width: VectorType { get set } -
The height of the
SizeBase(the second component of the vector).Declaration
Swift
public var height: VectorType { get set } -
Initializes the zero size.
Declaration
Swift
public init() -
Initializes a
SizeBasewith the given values.Declaration
Swift
public init(width: VectorType, height: VectorType)Parameters
widthThe first component of the vector.
heightThe second component of the vector.
-
Provides access to the underlying components of this instance.
Declaration
Swift
public subscript(index: Int) -> VectorType { get set }Parameters
indexThe index of the component to access.
Return Value
The component at the given index.
-
Initializes the size with the given value for
rowandcolumn.Declaration
Swift
public init(rows: VectorType, columns: VectorType)Parameters
rowThe first component of the size.
columnThe second component of the size.
-
The first component of the size.
Declaration
Swift
public var rows: VectorType { get set } -
The second component of the size.
Declaration
Swift
public var columns: VectorType { get set }
-
The unit vector in the width direction.
Declaration
Swift
public static var unitWidth: SizeBase<VectorType> { get } -
The unit vector in the height direction.
Declaration
Swift
public static var unitHeight: SizeBase<VectorType> { get }
-
Determines if a rect with origin (zero, zero) and size
selfcontains the given point.Declaration
Swift
public func contains(point: PointBase<VectorType>) -> BoolParameters
pointThe given point.
Return Value
trueif the rect with sizeselfand origin (zero, zero) containspoint,falseotherwise.
SizeBase Structure Reference