SizeBase
public struct SizeBase<VectorType> where VectorType : Addable
A 2-dimensional vector representing a size.
-
The number of components in a
SizeBase
instance.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
SizeBase
with the given values.Declaration
Swift
public init(width: VectorType, height: VectorType)
Parameters
width
The first component of the vector.
height
The second component of the vector.
-
Provides access to the underlying components of this instance.
Declaration
Swift
public subscript(index: Int) -> VectorType { get set }
Parameters
index
The index of the component to access.
Return Value
The component at the given index.
-
Initializes the size with the given value for
row
andcolumn
.Declaration
Swift
public init(rows: VectorType, columns: VectorType)
Parameters
row
The first component of the size.
column
The 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
self
contains the given point.Declaration
Swift
public func contains(point: PointBase<VectorType>) -> Bool
Parameters
point
The given point.
Return Value
true
if the rect with sizeself
and origin (zero, zero) containspoint
,false
otherwise.